Releases: apple/swift-argument-parser
ArgumentParser 1.2.1
Changes
- Documentation is now primarily hosted at the Swift Package Index.
Fixes
exit(_:)no longer causes infinite recursion on the WASI platform. (#520)- Completion scripts for
fishnow provide completions after a non-hyphen-prefixed argument has been provided. (#535) - Overload selection for custom
ExpressibleByArgumenttypes has been improved. (#522) - The usage string for
.postTerminatorarguments now includes the required terminator (--). (#542) - Documentation and testing fixes and improvements.
The 1.2.1 release includes contributions from @Chamepp, @KKK669, @mtj0928, @natecook1000, @rauhul, @rickrizzo, @TiagoMaiaL, and @yim-lee. Thank you!
ArgumentParser 1.2.0
Additions
-
You can now provide a title in an
@OptionGroupdeclaration. Titled option groups are listed separately in the help screen under that title as a heading. (#492) -
Two new parsing strategies have been added for
@Argumentarray properties:.allUnrecognizedcaptures all unrecognized inputs after parsing known flags, options, and arguments..postTerminatorcollects any inputs that follow the--terminator.
See the
ArgumentArrayParsingStrategydocumentation for more. (#496) -
Default values are now supported for
@Argumentor@Optionproperties with optional type, allowing you to initialize those properties withnil. Providing a non-nildefault value results in a warning, since optional properties with non-nildefaults don't need to be declared as optionals. (#477, #480)
Changes
- The
.unconditionalRemainingarray parsing strategy has been deprecated and renamed to.captureForPassthrough, to better fit its semantic behavior and intended usage. See theArgumentArrayParsingStrategydocumentation for more. (#496)
Fixes
- Invalid
init(from:)decoding initializers are now correctly diagnosed by ArgumentParser's validators. (#487) - Default values are now correctly displayed as flags for
@Flagproperties with inversions orEnumerableFlagtypes. (#486) - The help display for non-string-backed raw representable types has been corrected to not show raw Swift values. Instead, the help display uses the type's customized
defaultValueDescriptionandallValuesimplementations. (#494) - Properties at different levels of a command hierarchy with the same Swift name but different argument names no longer collide. (#495)
- The
generate-manualplugin name is improved when used from within Xcode. (#505) - Documentation fixes and improvements.
The 1.2.0 release includes contributions from @allevato, @clayellis, @compnerd, @d-ronnqvist, @natecook1000, @randomeizer, and @rauhul. Thank you!
ArgumentParser 1.1.4
Changes
-
The
generate-manualplugin now defaults to creating single page manuals. The--single-pageflag has been replaced with--multi-pageto restore the previous default functionality. (#472)Migration: Update scripts that invoked
generate-manualwithout--single-pageto include--multi-pageand update scripts that invokedgenerate-manualwith--single-pageto omit the flag. -
The "experimental" prefix from the
generate-manualplugin has been removed. (#475)Migration: Update scripts to invoke the
generate-manualplugin viaswift package generate-manualinstead ofswift package plugin experimental-generate-manual.
Fixes
- The
generate-manualplugin is correctly declared as a product, making the plugin visible to clients. (#456) - The
generate-manualplugin's--authorsarguments are now correctly passed to the underlying generation tool. (#471) - Manuals generated by the
generate-manualplugin now include the option's value names and do not include value names for flags. (#473) - Built-in flags such as
--helpand--versionare now correctly marked as optional fixing some generated content which indicated the flags are always required. (#474) - Value descriptions are now correctly derived for types which are
ExpressibleByArgumentandRawRepresentablebyString. Help menus will now display valid default values for such types. (#476)
The 1.1.4 release includes contributions from @ian-twilightcoder, @MarcoEidinger, and @rauhul. Thank you!
ArgumentParser 1.1.3
Additions
ArgumentParsernow includes a SwiftPM plugin for generatingmanpages. Explore the functionality and configuration by runningswift package plugin experimental-generate-manual --helpfrom your package root. (#332)
Fixes
- Hidden subcommands are now excluded from completion scripts. (#443)
- When an invalid value is provided for a
CaseIterabletype, the error message now includes a list of valid inputs. (#445) - There's now a diagnostic when an
AsyncParsableCommandis incorrectly placed under a non-asyncroot command. (#436)
The 1.1.3 release includes contributions from @keith, @KeithBird, @konomae, @LucianoPAlmeida, and @rauhul. Thank you!
ArgumentParser 1.1.2
Changes
- CMake builds now always statically link
ArgumentParserToolInfo. (#424)
Fixes
- When a user provides an array-based option's key (e.g.
--key) without any values, the error message now correctly describes the problem. (#435)
The 1.1.2 release includes contributions from @compnerd and @KeithBird. Thank you!
ArgumentParser 1.1.1
Fixes
- Moves the platform requirement from the package level down to the new types and protocols with
asyncmembers. This was a source-breaking change in 1.1.0. (#427) - Fixed issues in the CMake build configuration.
ArgumentParser 1.1.0
Additions
- A command's
run()method now supportsasync/awaitwhen the command conforms toAsyncParsableCommand. (#404) - New API for distinguishing between public, hidden, and private arguments and option groups, and a new extended help screen accessible via
--help-hidden. (#366, #390, and #405 through #413) - You can now override the autogenerated usage string when configuring a command. (#400)
Changes
ArgumentParsernow requires Swift 5.5.
Fixes
- The auto-generated usage string now correctly hides all optional parameters when over the length limit. (#416)
- One
@Optioninitializer now has its parameters in the correct order; the incorrect initializer is deprecated. (#391) - Help flags are now correctly captured in
.unconditionalRemainingargument arrays. - Documentation fixes and improvements.
The 1.1.0 release includes contributions from @keith, @MartinP7r, @McNight, @natecook1000, @rauhul, and @zkiraly. Thank you!
ArgumentParser 1.0.3
Changes
-
When a user provides an incorrect value for an option, an
ArgumentParser-based program now includes the valid values when possible.$ example --format png Error: The value 'png' is invalid for '--format <format>'. Please provide one of 'text', 'json' or 'csv'.
Fixes
- Resolves an issue with
zshcustom completions for command names that include a dash. - Improves the generated completions scripts for
fish. - Resolves issues that prevented building
ArgumentParserfor WebAssembly using SwiftWasm toolchains. - Improved window size handling on Windows.
- Fixed a crash when using
--experimental-dump-helpwith commands that provide non-parsed values. - Fixes an issue where subcommands that declare array arguments with the
.unconditionalRemainingparsing strategy unexpectedly miss arguments, extending the change in #333 to subcommands. (#397) - Corrects the order of an
@Optioninitializer's parameters, deprecating the old version. (#391) - Expanded and corrected documentation.
The 1.0.3 release includes contributions from @atierian, @CraigSiemens, @dduan, @floam, @KS1019, @McNight, @mdznr, @natecook1000, @rauhul, and @yonihemi. Thank you!
ArgumentParser 1.0.2
Fixes
- Addresses an issue when building tests under Mac Catalyst.
ArgumentParser 1.0.1
Fixes
- Addresses an issue when compiling under Mac Catalyst.