ArgumentParser 0.2.0
Additions
- You can now specify default values for array properties of parsable types.
The default values are overridden if the user provides at least one value
as part of the command-line arguments.
Changes
-
This release of
swift-argument-parser
requires Swift 5.2. -
Default values for all properties are now written using default initialization
syntax, including some values that were previously implicit, such as empty
arrays andfalse
for Boolean flags.Migration: Specify default values using typical Swift default value syntax
to remove the deprecation warnings:// old @Flag() var verbose: Bool // new @Flag() var verbose = false
Important: There is a semantic change for flags with inversions that do
not have a default value. In previous releases, these flags had a default
value offalse
; starting in 0.2.0, these flags will have no default, and
will therefore be required by the user. Specify a default value offalse
to
retain the old behavior.
Fixes
- Options with multiple names now consistently show the first-declared name
in usage and help screens. - Default subcommands are indicated in the help screen.
- User errors with options are now shown before positional argument errors,
eliminating some false negative reports. - CMake compatibility fixes.