ArgumentParser 0.1.0
Additions
- Error messages and help screens now include information about how to request
more help. - CMake builds now support installation.
Changes
-
The
static func main()method onParsableCommandno longer returns
Never. This allowsParsableCommandtypes to be designated as the entry
point for a Swift executable by using the@mainattribute.Migration: For most uses, this change is source compatible. If you have
usedmain()where a() -> Neverfunction is explicitly required, you'll
need to change your usage or capture the method in another function. -
Optionalno longer conforms toExpressibleByArgument, to avoid some
property declarations that don't make sense.Migration: This is source-compatible for all property declarations, with
deprecations for optional properties that define an explicit default. If
you're using optional values where anExpressibleByArgumenttype is
expected, such as a generic function, you will need to change your usage
or provide an explicit override. -
ParsableCommand'srun()method requirement is now amutatingmethod,
allowing mutations to a command's properties, such as sorting an array of
arguments, without additional copying.Migration: No changes are required for commands that are executed through
themain()method. If you manually parse a command and then call its
run()method, you may need to change the command from a constant to a
variable.
Removals
- The
@Flaginitializers that were deprecated in version 0.0.6 are now
marked as unavailable.
Fixes
@Optionproperties of an optional type that use atransformclosure now
correctly indicate their optionality in the usage string.- Correct wrapping and indentation are maintained for abstracts and discussions
with short lines. - Empty abstracts no longer add extra blank lines to the help screen.
- Help requests are still honored even when a parsed command fails validation.
- The
--terminator isn't consumed when parsing a command, so that it can be
parsed as a value when a subcommand includes an.unconditionalRemaining
argument array. - CMake builds work correctly again.