Releases: apple/swift-argument-parser
ArgumentParser 1.0
The 1.0 release marks an important milestone — ArgumentParser is now source stable!
Changes
ArgumentParsernow provides a DocC documentation catalog, so you can view rendered articles and symbol documentation directly within Xcode.
Fixes
- Parsing works as expected for options with single-dash names that are declared using the
.upToNextOptionparsing strategy.
ArgumentParser 0.5.0
Additions
- When a user doesn't provide a required argument, the error message now includes that argument's help text. (#324)
- Command-line tools built with
ArgumentParsernow include an experimental flag to dump command/argument/help information as JSON:--experimental-dump-help. (#310)
Changes
- All public enumerations are now structs with static properties, to make compatibility with future additions simpler.
Fixes
-
Array properties defined as
@Optionwith the.upToNextOptionparsing strategy now include all provided values. (#304) In the example below, all four values are now included in the resulting array, where only the last two were included in previous releases:struct Example: ParsableCommand { @Option(parsing: .upToNextOption) var option: String }
$ example --option one two --option three four -
When a command defines an array property as an
@Argumentwith the.unconditionalRemainingparsing strategy, option and flag parsing now stops at the first positional argument or unrecognized flag. (#333) -
Completion scripts correctly use customized help flags. (#308)
-
Fixes errors with bash custom completion arguments and the executable path. (#320, #323)
-
Fixes the behavior when a user specifies both the
helpsubcommand and a help flag. (#309) -
A variety of internal improvements. (#315, #316, #321, #341)
ArgumentParser 0.4.4
Fixes
- Includes a workaround for a runtime crash with certain
OptionGroupconfigurations when a command is compiled in release mode.
ArgumentParser 0.4.3
Additions
- Experimental API for hiding
@OptionGroup-declared properties from the help screen.
ArgumentParser 0.4.2
Fixes
- Both parts of a flag with an inversion are now hidden when specified.
- Better support for building on OpenBSD.
- Optional unparsed values are now always properly decoded. (#290)
- Help information from super-commands is no longer unnecessarily injected into subcommand help screens.
ArgumentParser 0.4.1
Additions
- When a user provides an invalid value as an argument or option, the error message now includes the help text for that argument.
Fixes
- Zsh completion scripts for commands that include a hyphen no longer cause errors.
- Optional unparsed values are now decoded correctly in
ParsableArgumentstypes.
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.
ArgumentParser 0.3.2
Fixes
- Changes made to a command's properties in its
validatemethod are now persisted. - The exit code defined by error types that conform to
CustomNSErrorare now honored. - Improved error message when declaring a command type with an unadorned mutable property. (See #256 for more.)
- Migrated from
CRTtoMSVCRTfor Windows platforms. - Fixes and improvements for building with CMake for Windows and Apple Silicon.
- Documentation improvements.
ArgumentParser 0.3.1
Fixes
-
An option or flag can now declare a name with both single- and double-
dash prefixes, such as-my-flagand--my-flag. Specify both names in the
nameparameter when declaring your property:@Flag(name: [.long, .customLong("my-flag", withSingleDash: true)]) var myFlag = false
-
Parsing performance improvements.
ArgumentParser 0.3.0
Additions
- Shell completions scripts are now available for Fish.
Changes
-
Array properties without a default value are now treated as required for the
user of a command-line tool. In previous versions of the library, these
properties defaulted to an empty array; a deprecation was introduced for this
behavior in version 0.2.0.Migration: Specify an empty array as the default value for properties that
should not require user input:// old @Option var names: [String] // new @Option var names: [String] = []