ArgumentParser 0.4.0
Additions
-
Short options can now support "joined option" syntax, which lets users specify a value appended immediately after the option's short name. For example, in addition to calling this
examplecommand with-D debugand-D=debug, users can now write-Ddebugfor the same parsed value. (#240)@main struct Example: ParsableCommand { @Option(name: .customShort("D", allowingJoined: true)) var debugValue: String func run() { print(debugValue) } }
Changes
-
The
CommandConfiguration.helpNamesproperty is now optional, to allow the overridden help flags of parent commands to flow down to their children. Most existing code should not be affected, but if you've customized a command's help flags you may see different behavior. (#251) -
The
errorCodeproperty is no longer used as a command's exit code whenCustomNSErrortypes are thrown. (#276)Migration: Instead of throwing a
CustomNSErrortype, print your error manually and throw anExitCodeerror to customize your command's exit code.
Removals
- Old, deprecated property wrapper initializers have been removed.
Fixes
- Validation errors now show the correct help flags when help flags have been customized.
- Options, flags, and arguments that are marked as hidden from the help screen are also suppressed from completion scripts.
- Non-parsed variable properties are now allowed in parsable types.
- Error messages produced when
NSErrortypes are thrown have been improved. - The usage line for commands with a large number of options includes more detail about required flags and positional arguments.
- Support for CMake builds on Apple Silicon is improved.