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 onParsableCommand
no longer returns
Never
. This allowsParsableCommand
types to be designated as the entry
point for a Swift executable by using the@main
attribute.Migration: For most uses, this change is source compatible. If you have
usedmain()
where a() -> Never
function is explicitly required, you'll
need to change your usage or capture the method in another function. -
Optional
no 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 anExpressibleByArgument
type 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 amutating
method,
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
@Flag
initializers that were deprecated in version 0.0.6 are now
marked as unavailable.
Fixes
@Option
properties of an optional type that use atransform
closure 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.