This change lets you provide a title for option groups, which is used
when generating the help screen. Titled option groups, when they exist,
are placed between the ARGUMENTS and OPTIONS section of the help.
Multiple option groups with the same title are coalesced into a single
group.
For example, this command declaration:
struct Extras: ParsableArguments {
@Flag(help: "Print extra output while processing.")
var verbose: Bool = false
@Flag(help: "Include details no one asked for.")
var oversharing: Bool = false
}
@main
struct Example: ParsableCommand {
@OptionGroup(title: "Extras")
var extras: Extras
@Argument var name: String?
@Option var title: String?
}
yields this help screen:
USAGE: example [--verbose] [--oversharing] [<name>] [--title <title>]
ARGUMENTS:
<name>
EXTRAS:
--verbose Print extra output while processing.
--oversharing Include details no one asked for.
OPTIONS:
--title <title>
-h, --help Show help information.
- Adds check to ensure that `wrapped(to:wrappingIndent:)` doesn't
attempt to retrieve a negative prefix.
- The Usage struct was composed of an array of strings which always
contained exact one string at runtime. This struct has been removed
and replaced with a single usage string.
- Removes HelpGenerator._screenWidthOverride in favor of explicitly
setting the screen width in generateHelp calls.
Support for generating shell completion scripts for `ParsableCommand`
types, with customization points for `ExpressibleByArgument` types and
individual arguments and options. Zsh and Bash are supported in this
initial release.
* Add String#editDistance(to:)
Uses levenshtein distance to determine how much two strings differ.
See: https://en.wikipedia.org/wiki/Levenshtein_distance
* Simplify unknownOptionMessage
The logic of Name#synopsisString was repeated in unknownOptionMessage.
This change sit so that unknownOptionMessage defer to Name's
implementation instead.
* Provide suggestions for unknown options