Arguments declared with the `.allUnrecognized` parsing strategy
currently capture built-in flags, which isn't intended. This
fixes that issue by looking for built-in flags in the captured
portion of the input before decoding.
Fixes rdar://104990388
This adds two new parsing options for argument arrays, and renames
`.unconditionalRemaining` to `.captureForPassthrough`.
- `.allUnrecognized` collects all the inputs that weren't used during
parsing. This essentially suppresses all "unrecognized flag/option"
and "unexpected argument" errors, and makes those extra inputs
available to the client.
- `.postTerminator` collects all inputs that follow the `--`
terminator, before trying to parse any other positional arguments.
This is a non-standard, but sometimes useful parsing strategy.
* Convert some linear operations to constant time
* Temporary test command for performance testing
* Improve SplitArguments docs
* Re-enable split arguments unit test
* Restore repeat example
Support for generating shell completion scripts for `ParsableCommand`
types, with customization points for `ExpressibleByArgument` types and
individual arguments and options. Zsh and Bash are supported in this
initial release.
If an argument has a single dash and single character, followed by a value, treat it as a short name.
`-c=1` -> `Name.short("c")`
Otherwise, treat it as a long name with single dash.
`-count=1` -> `Name.longWithSingleDash("count")`
* Add a catch-all argument parsing strategy
We don't currently have a way for `@Argument` arrays to capture
command-line inputs that look like options. This capability is
important for tools like SwiftPM that need to forward input to
another command.
This introduces an `ArgumentArrayParsingStrategy` enum with a
`remaining` case that matches the current behavior, as well as an
`unconditionalRemaining` case that captures all remaining input. The
two array-based `@Argument` initializers gain defaulted parameters for
the parsing strategy.
* Address feedback from @danieleggert
- Added a bit of a warning for the unconditional parsing strategy
- Switched to a better way of getting the original input
- Changed to pulling the "earliest" element when combining positional and
unused values, rather than combining and sorting. This felt more
efficient than reconstructing a SplitArguments instance or combining
and sorting.
* Add parameter docs for argument parsing strategy
* Expand documentation and tests to cover `--` terminator
* Fix case name in API documentation
* Corrected grammatical and spelling errors in files in Documentation.
* Correct various spelling, grammar, and formatting mistakes in code documentation.