github apple/swift-argument-parser 0.4.0
ArgumentParser 0.4.0

latest releases: 1.3.1, 1.3.0, 1.2.3...
3 years ago

Additions

  • Short options can now support "joined option" syntax, which lets users specify a value appended immediately after the option's short name. For example, in addition to calling this example command with -D debug and -D=debug, users can now write -Ddebug for the same parsed value. (#240)

    @main
    struct Example: ParsableCommand {
        @Option(name: .customShort("D", allowingJoined: true))
        var debugValue: String
      
        func run() {
            print(debugValue)
        }
    }

Changes

  • The CommandConfiguration.helpNames property is now optional, to allow the overridden help flags of parent commands to flow down to their children. Most existing code should not be affected, but if you've customized a command's help flags you may see different behavior. (#251)

  • The errorCode property is no longer used as a command's exit code when CustomNSError types are thrown. (#276)

    Migration: Instead of throwing a CustomNSError type, print your error manually and throw an ExitCode error to customize your command's exit code.

Removals

  • Old, deprecated property wrapper initializers have been removed.

Fixes

  • Validation errors now show the correct help flags when help flags have been customized.
  • Options, flags, and arguments that are marked as hidden from the help screen are also suppressed from completion scripts.
  • Non-parsed variable properties are now allowed in parsable types.
  • Error messages produced when NSError types are thrown have been improved.
  • The usage line for commands with a large number of options includes more detail about required flags and positional arguments.
  • Support for CMake builds on Apple Silicon is improved.

Don't miss a new swift-argument-parser release

NewReleases is sending notifications on new releases.