Skip to content

ArgumentParser 0.2.0

Compare
Choose a tag to compare
@natecook1000 natecook1000 released this 23 Jun 16:05
eb51f94

Additions

  • You can now specify default values for array properties of parsable types.
    The default values are overridden if the user provides at least one value
    as part of the command-line arguments.

Changes

  • This release of swift-argument-parser requires Swift 5.2.

  • Default values for all properties are now written using default initialization
    syntax, including some values that were previously implicit, such as empty
    arrays and false for Boolean flags.

    Migration: Specify default values using typical Swift default value syntax
    to remove the deprecation warnings:

    // old
    @Flag() var verbose: Bool
    // new
    @Flag() var verbose = false

    Important: There is a semantic change for flags with inversions that do
    not have a default value. In previous releases, these flags had a default
    value of false; starting in 0.2.0, these flags will have no default, and
    will therefore be required by the user. Specify a default value of false to
    retain the old behavior.

Fixes

  • Options with multiple names now consistently show the first-declared name
    in usage and help screens.
  • Default subcommands are indicated in the help screen.
  • User errors with options are now shown before positional argument errors,
    eliminating some false negative reports.
  • CMake compatibility fixes.