Skip to content

Releases: apple/swift-argument-parser

ArgumentParser 0.0.6

14 May 17:57
223d62a
Compare
Choose a tag to compare

Additions

  • Command definition validation now checks for name collisions between options
    and flags.
  • ValidationError.message is now publicly accessible.
  • Added an EnumerableFlag protocol for CaseIterable types that are used to
    provide the names for flags. When declaring conformance to EnumerableFlag,
    you can override the name specification and help text for individual flags.
    See #65 for more detail.
  • When a command that requires arguments is called with no arguments at all,
    the error message includes the full help text instead of the short usage
    string. This is intended to provide a better experience for first-time users.
  • Added a helpMessage() method for generating the help text for a command
    or subcommand.

Deprecations

  • @Flag properties that use CaseIterable/String types as their values
    are deprecated, and the related @Flag initializers will be removed
    in a future version.

    Migration: Add EnumerableFlag conformance to the type of these kinds of
    @Flag properties.

Fixes

  • Errors thrown while parsing in a transform closure are printed correclty
    instead of a general Invalid state error.
  • Improvements to the guides and in the error message when attempting to access
    a value from an argument/option/flag definition.
  • Fixed issues in the CMake and Windows build configurations.
  • You can now use an = to join a value with an option's short name when calling
    a command. This previously only worked for long names.

ArgumentParser 0.0.5

15 Apr 19:49
9f04d1f
Compare
Choose a tag to compare

Additions

  • You can now specify a version string in a ParsableCommand's configuration.
    The generated tool will then automatically respond to a --version flag.
  • Command definitions are now validated at runtime in debug mode, to check
    issues that can't be detected during compilation.

Fixes

  • Deprecation warnings during compilation on Linux have been removed.
  • The validate() method is now called on each command in the matched command
    stack, instead of only the last command in the stack.

ArgumentParser 0.0.4

23 Mar 18:48
Compare
Choose a tag to compare

Fixes

  • Removed usage of 5.2-only syntax.

ArgumentParser 0.0.3

23 Mar 00:04
Compare
Choose a tag to compare

Additions

  • You can specify the .unconditionalRemaining parsing strategy for arrays of
    positional arguments to accept dash-prefixed input, like
    example --one two -three.
  • You can now provide a default value for a positional argument.
  • You can now customize the display of default values in the extended help for
    an ExpressibleByArgument type.
  • You can call the static exitCode(for:) method on any command to retrieve the
    exit code for a given error.

Fixes

  • Supporting targets are now prefixed to prevent conflicts with other libraries.
  • The extension providing init?(argument:) to RawRepresentable types is now
    properly constrained.
  • The parser no longer treats passing the same exclusive flag more than once as
    an error.
  • ParsableArguments types that are declared as @OptionGroup() properties on
    commands can now also be declared on subcommands. Previosuly, the parent
    command's declaration would prevent subcommands from seeing the user-supplied
    arguments.
  • Default values are rendered correctly for properties with Optional types.
  • The output of help requests is now printed during the "exit" phase of execution,
    instead of during the "run" phase.
  • Usage strings now correctly show that optional positional arguments aren't
    required.
  • Extended help now omits extra line breaks when displaying arguments or commands
    with long names that don't provide help text.

ArgumentParser 0.0.2

06 Mar 23:42
Compare
Choose a tag to compare

Additions

  • The EX_USAGE exit code is now used for validation errors.
  • The parser provides near-miss suggestions when a user provides an unknown option.
  • ArgumentParser now builds on Windows.
  • You can throw an ExitCode error to exit without printing any output.
  • You can now create optional Boolean flags with inversions that default to nil:
    @Flag(inversion: .prefixedNo) var takeMyShot: Bool?
  • You can now specify exclusivity for case-iterable flags and for Boolean flags with inversions.

Fixes

  • Cleaned up a wide variety of documentation typos and shortcomings.
  • Improved different kinds of error messages:
    • Duplicate exclusive flags now show the duplicated arguments.
    • Subcommand validation errors print the correct usage string.
  • In the help screen:
    • Removed the extra space before the default value for arguments without descriptions.
    • Removed the default value note when the default value is an empty string.
    • Default values are now shown for Boolean options.
    • Case-iterable flags are now grouped correctly.
    • Case-iterable flags with default values now show the default value.
    • Arguments from parent commands that are included via @OptionGroup in subcommands are no longer duplicated.
  • Case-iterable flags created with the .chooseFirst exclusivity parameter now correctly ignore additional flags.

ArgumentParser 0.0.1

27 Feb 22:08
Compare
Choose a tag to compare

Initial release.