Skip to content

update use of argument parser to latest API #6152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2023

Conversation

tomerd
Copy link
Contributor

@tomerd tomerd commented Feb 13, 2023

motivation: Address warnings

changes: use newer API for retrieving unparsed arguments

motivation: Address warnings

changes: use newer API for retreiving unparsed arguments
@tomerd
Copy link
Contributor Author

tomerd commented Feb 13, 2023

@swift-ci smoke test

@tomerd tomerd self-assigned this Feb 13, 2023
@tomerd
Copy link
Contributor Author

tomerd commented Feb 14, 2023

@natecook1000 this is an attempt to update the new allUnrecognized API but testCommandPluginArgumentsNotSwallowed which worked previously is failing with this, basically seems like the --help and --version arguments get swallowed again. any advise?

@natecook1000
Copy link
Member

natecook1000 commented Feb 14, 2023

All of these except for the command you use for re-parsing the input should be .captureForPassthrough to maintain the same behavior, as that's the new name for .unconditionalRemaining. The new .allUnrecognized parsing strategy doesn't capture help flags, since those belong to the original command.

@natecook1000
Copy link
Member

🤔 Although, thinking of it now, using .allUnrecognized to re-parse will probably ditch when it sees the help flags. You'll want to add this to the PluginArguments type so that it doesn't try to parse any help flags:

struct PluginArguments: ParsableCommand {
    static var configuration: CommandConfiguration {
        .init(helpNames: [])
    }
    // etc...
}

@tomerd
Copy link
Contributor Author

tomerd commented Feb 14, 2023

@swift-ci smoke test

@tomerd tomerd enabled auto-merge (squash) February 14, 2023 21:00
@tomerd tomerd merged commit e1eba90 into swiftlang:main Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants