Straightforward, type-safe argument parsing for Swift
CommandConfigration
type is now designated as Sendable
. (#615)internal
imports instead of @_implementationOnly
annotations in Swift versions where permitted. (#616)@Option
- and @Argument
-annotated optional properties that use a transform
closure for parsing can now be declared without ambiguity. (#619)
The help flag is now recognized more consistently when a default subcommand has been specified. (#612)
Options that use the .upToNextOption
parsing strategy can now recognize an attached value (e.g. --numbers=1 2 3
). (#610)
Generated completion scripts for zsh
handle repeatable options correctly. (#614)
Documentation improvements and clarifications. (#607, #611, #617, #621)
Build improvements for CMake builds. (#606, #608)
The 1.3.1 release includes contributions from @Coeur, @compnerd, @keith, @MaxDesiatov, @mayoff, and @natecook1000. Thank you!
The @Option
, @Argument
, @Flag
, and @OptionGroup
property wrappers now conditionally conform to Sendable
when the wrapper's Value
type conforms. With this change, you can mark ParsableCommand
types as Sendable
when you want to be able to pass a parsed command across concurrent contexts. (#582)
Migration: Users that aren't ready to resolve sendability warnings can add the @preconcurrency
attribute to import ArgumentParser
statements.
To support migration to Sendable
annotation, the minimum Swift version for swift-argument-parser
has been increased to Swift 5.7. Users of older Swift versions will be able to continue using version 1.2.3 of the library. (#582)
ExpressibleByArgument
types with non empty allValueStrings
. Types also conforming to CaseIterable
do not need to manually implement allValueStrings
, instead it is derived from allCases
. (#594)COLUMNS
environment variable when set, instead of immediately falling back to 80 columns. (#596).file(...)
completion kind. (#590)The 1.2.3 release includes contributions from @Alkenso, @compnerd, @gwynne, @kennyyork, @natecook1000, @rauhul, @robertmryan, and @vlm. Thank you!
ArgumentParserTestHelpers
to
fail to link when building for Windows. (#579)The 1.2.3 release includes contributions from @compnerd, @gwynne, @MaxDesiatov, @natecook1000, and @rauhul. Thank you!
.allUnrecognized
parsing strategy no longer consume built-in flags like --help
and --version
. (#550)ParsableCommand.main()
static method to be run on an AsyncParsableCommand
type. (#547)exit(_:)
no longer causes infinite recursion on the WASI platform. (#520)fish
now provide completions after a non-hyphen-prefixed argument has been provided. (#535)ExpressibleByArgument
types has been improved. (#522).postTerminator
arguments now includes the required terminator (--
). (#542)The 1.2.1 release includes contributions from @Chamepp, @kkk669, @mtj0928, @natecook1000, @rauhul, @rickrizzo, @TiagoMaiaL, and @yim-lee. Thank you!
You can now provide a title in an @OptionGroup
declaration. 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 @Argument
array properties:
.allUnrecognized
captures all unrecognized inputs after parsing known flags, options, and arguments..postTerminator
collects any inputs that follow the --
terminator.See the ArgumentArrayParsingStrategy
documentation for more. (#496)
Default values are now supported for @Argument
or @Option
properties with optional type, allowing you to initialize those properties with nil
. Providing a non-nil
default value results in a warning, since optional properties with non-nil
defaults don't need to be declared as optionals. (#477, #480)
.unconditionalRemaining
array parsing strategy has been deprecated and renamed to .captureForPassthrough
, to better fit its semantic behavior and intended usage. See the ArgumentArrayParsingStrategy
documentation for more. (#496)init(from:)
decoding initializers are now correctly diagnosed by ArgumentParser's validators. (#487)@Flag
properties with inversions or EnumerableFlag
types. (#486)defaultValueDescription
and allValues
implementations. (#494)generate-manual
plugin name is improved when used from within Xcode. (#505)The 1.2.0 release includes contributions from @allevato, @clayellis, @compnerd, @d-ronnqvist, @natecook1000, @randomeizer, and @rauhul. Thank you!
The generate-manual
plugin now defaults to creating single page manuals. The --single-page
flag has been replaced with --multi-page
to restore the previous default functionality. (#472)
Migration: Update scripts that invoked generate-manual
without --single-page
to include --multi-page
and update scripts that invoked generate-manual
with --single-page
to omit the flag.
The "experimental" prefix from the generate-manual
plugin has been removed. (#475)
Migration: Update scripts to invoke the generate-manual
plugin via swift package generate-manual
instead of swift package plugin experimental-generate-manual
.
generate-manual
plugin is correctly declared as a product, making the plugin visible to clients. (#456)generate-manual
plugin's --authors
arguments are now correctly passed to the underlying generation tool. (#471)generate-manual
plugin now include the option's value names and do not include value names for flags. (#473)--help
and --version
are now correctly marked as optional fixing some generated content which indicated the flags are always required. (#474)ExpressibleByArgument
and RawRepresentable
by String
. 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
now includes a SwiftPM plugin for generating man
pages. Explore the functionality and configuration by running swift package plugin experimental-generate-manual --help
from your package root. (#332)CaseIterable
type, the error message now includes a list of valid inputs. (#445)AsyncParsableCommand
is incorrectly placed under a non-async
root command. (#436)The 1.1.3 release includes contributions from @keith, @KeithBird, @konomae, @LucianoPAlmeida, and @rauhul. Thank you!
ArgumentParserToolInfo
. (#424)--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!