Swift Argument Parser v0.4.0 Release Notes
Release Date: 2021-03-04 // about 3 years ago-
โ 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
example
command with-D debug
and-D=debug
, users can now write-Ddebug
for 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.helpNames
property 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
errorCode
property is no longer used as a command's exit code whenCustomNSError
types are thrown. ([#276])
Migration: Instead of throwing a
CustomNSError
type, print your error manually and throw anExitCode
error 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
NSError
types 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.
๐ The 0.4.0 release includes contributions from [CodaFi], [lorentey], [natecook1000], [schlagelk], and [Zoha131]. Thank you!
- ๐ 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