feat(UsageStrings): Add localisable labels record for usage rendering#303
Open
dimension-zero wants to merge 2 commits into
Open
feat(UsageStrings): Add localisable labels record for usage rendering#303dimension-zero wants to merge 2 commits into
dimension-zero wants to merge 2 commits into
Conversation
* Types.fs: New public UsageStrings record carrying Usage, Options, Subcommands and SubcommandHelpHint. UsageStrings.Default returns the historical English labels. * UnParsers.fs: New mkUsageStringWithLabels that threads a UsageStrings through the renderer. Old mkUsageString kept as a thin forwarder using UsageStrings.Default, so all existing internal call sites are byte-identical. * ArgumentParser.fs: PrintUsage gains an optional ?usageStrings parameter defaulting to UsageStrings.Default. Existing signatures unchanged for positional callers (the new parameter is optional and appended last). Additive only. The four hard-coded English labels are still emitted when no UsageStrings is passed, preserving every existing rendered byte.
5 new tests:
* UsageStrings.Default returns the historical English labels verbatim.
* PrintUsage() with no override emits the English headers.
* PrintUsage(usageStrings = french) emits the French headers and never
the English ones.
* SubcommandHelpHint default placeholder {0} / {1} interpolation is
applied so the rendered hint shows 'myapp <subcommand> --help'.
* A fully custom SubcommandHelpHint replaces the default hint line.
Net suite size on this branch: 112 -> 117.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(UsageStrings): Add localisable labels record for usage rendering
Subcommands and SubcommandHelpHint. UsageStrings.Default returns the
historical English labels.
through the renderer. Old mkUsageString kept as a thin forwarder using
UsageStrings.Default, so all existing internal call sites are
byte-identical.
defaulting to UsageStrings.Default. Existing signatures unchanged for
positional callers (the new parameter is optional and appended last).
Additive only. The four hard-coded English labels are still emitted when
no UsageStrings is passed, preserving every existing rendered byte.
test(UsageStrings): Add coverage for localisation hooks
5 new tests:
the English ones.
applied so the rendered hint shows 'myapp --help'.
Net suite size on this branch: 112 -> 117.