Add two new ArgumentArrayParsingStrategy
options
#496
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds two new parsing options for argument arrays, and renames
.unconditionalRemaining
to.captureForPassthrough
:unconditionalRemaining
has been an attractive nuisance. It looks like it means "everything leftover", but it actually has a specific and slightly strange set of behaviors to support SwiftPM capturing inputs to pass on to a sub-client, as inswift run MyExecutableTarget
. The new name better matches this intended usage.allUnrecognized
collects all the inputs that weren't used during parsing, which is a more generally useful behavior. 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.Detailed Design
Two new symbols and one renaming — see the diff for full API documentation.
Documentation Plan
Includes API documentation for the new symbols and significantly expanded docs for the existing members.
Test Plan
Includes unit tests for the new cases.
Source Impact
This deprecates the
unconditionalRemaining
strategy, which was confusingly named. The new name iscaptureForPassthrough
, which is more explicit about its intent.Checklist