Skip to content

Releases: apple/swift-argument-parser

ArgumentParser 1.5.0

18 Jul 18:04
41982a3
Compare
Choose a tag to compare

Additions

  • Subcommands can now be grouped into sections, to enable a better help display for commands with many subcommands. (#644)
  • Improved unofficial support for Android and riscv64 platforms. (#649, #651)

Fixes

  • Command-line completion scripts correctly complete for arguments that are included via option group. (#648)
  • Several warnings when compiling with strict concurrency enabled, or in Swift 6 language mode, are now silenced. (#650)

The 1.5.0 release includes contributions from @CraigSiemens, @DougGregor, @finagolfin, @futurejones, and @natecook1000. Thank you!

ArgumentParser 1.4.0

21 May 22:53
0fbc884
Compare
Choose a tag to compare

Additions

  • Adds support for subcommand aliases via a new CommandConfiguration.aliases parameter. Aliases are shown in help text and used during command parsing. For example, a subcommand like "average" from the example "math" tool can be defined with the aliases ["avg"]. The resulting subcommand can now be invoked with either of math stats average and ``math stats avg`. See the updated documentation and example for additional details. (#627)
  • Adds a new API usageString to ParsableArguments and ParsableCommand for retrieving their usage text, allowing for more flexible construction of error screens. (#634)
  • Adds support for passing custom arguments to AsyncParsableCommand.main() with a new static func main(_ arguments: [String]?) async method. (#568)

Fixes

  • Removes default parameter values from deprecated CommandConfiguration initializers to prevent them from being selected as overloads. Some niche invalid deprecation warnings should no longer occur. (#636)

The 1.4.0 release includes contributions from @Austinpayne, @dcantah, @KS1019, @natecook1000, @rauhul, and @revolter. Thank you!

ArgumentParser 1.3.1

16 Mar 18:23
4698969
Compare
Choose a tag to compare

Changes

  • The CommandConfigration type is now designated as Sendable. (#615)
  • The library uses internal imports instead of @_implementationOnly annotations in Swift versions where permitted. (#616)

Fixes

  • @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!

ArgumentParser 1.3.0

07 Dec 05:27
c8ed701
Compare
Choose a tag to compare

Changes

  • 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)

Additions

  • Help screens now include possible options for 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)

Fixes

  • The titles for nested option groups are preserved when embedded into commands without specifying a new title. (#592)
  • When wrapping help and error messages, the library now uses the COLUMNS environment variable when set, instead of immediately falling back to 80 columns. (#596)
  • Bash completion scripts now respect the extensions given in a .file(...) completion kind. (#590)
  • Bash completion scripts now properly escape command names that include hyphens. (#573)
  • Documentation improvements. (#572, #565, #602)

The 1.2.3 release includes contributions from @Alkenso, @compnerd, @gwynne,
@kennyyork, @natecook1000, @rauhul, @robertmryan, and @vlm. Thank you!

ArgumentParser 1.2.3

15 Aug 19:04
8f4d275
Compare
Choose a tag to compare

Additions

  • You can now use ArgumentParser with Musl libc. (#574)

Fixes

  • Fixes a bug where single-page manuals did not include command abstracts for
    subcommands. (#552)
  • Fixes a bug where non-optional properties in ParsableCommands could cause
    ArgumentParser to crash. You can now include properties like dictionaries in
    ParsableCommands without issue. (#554)
  • Fixes a configuration issue which would cause 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!

ArgumentParser 1.2.2

09 Feb 17:27
fee6933
Compare
Choose a tag to compare

Fixes

  • Arguments with the .allUnrecognized parsing strategy no longer consume built-in flags like --help and --version. (#550)
  • Fixes an issue introduced in version 1.2.0 where properties with underscored names couldn't be parsed. (#548)
  • Improves the error message for cases where platform availability causes the synchronous ParsableCommand.main() static method to be run on an AsyncParsableCommand type. (#547)

ArgumentParser 1.2.1

13 Jan 19:19
4ad606b
Compare
Choose a tag to compare

Changes

Fixes

  • exit(_:) no longer causes infinite recursion on the WASI platform. (#520)
  • Completion scripts for fish now provide completions after a non-hyphen-prefixed argument has been provided. (#535)
  • Overload selection for custom ExpressibleByArgument types has been improved. (#522)
  • The usage string for .postTerminator arguments 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

08 Nov 19:47
fddd1c0
Compare
Choose a tag to compare

Additions

  • 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)

Changes

  • The .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)

Fixes

  • Invalid init(from:) decoding initializers are now correctly diagnosed by ArgumentParser's validators. (#487)
  • Default values are now correctly displayed as flags for @Flag properties with inversions or EnumerableFlag types. (#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 defaultValueDescription and allValues implementations. (#494)
  • Properties at different levels of a command hierarchy with the same Swift name but different argument names no longer collide. (#495)
  • The generate-manual plugin 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

27 Aug 03:34
9f39744
Compare
Choose a tag to compare

Changes

  • 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.

Fixes

  • The generate-manual plugin is correctly declared as a product, making the plugin visible to clients. (#456)
  • The generate-manual plugin's --authors arguments are now correctly passed to the underlying generation tool. (#471)
  • Manuals generated by the generate-manual plugin now include the option's value names and do not include value names for flags. (#473)
  • Built-in flags such as --help and --version are 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 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 1.1.3

23 Jun 18:30
df9ee66
Compare
Choose a tag to compare

Additions

  • 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)

Fixes

  • Hidden subcommands are now excluded from completion scripts. (#443)
  • When an invalid value is provided for a CaseIterable type, the error message now includes a list of valid inputs. (#445)
  • There's now a diagnostic when an 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!