Skip to content
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

Get expanded @-file arguments? #1074

Closed
mashlol opened this issue May 26, 2020 · 3 comments
Closed

Get expanded @-file arguments? #1074

mashlol opened this issue May 26, 2020 · 3 comments
Labels
theme: parser An issue or change related to the parser type: API 🔌
Milestone

Comments

@mashlol
Copy link
Contributor

mashlol commented May 26, 2020

Is it possible to get the parsed, expanded @-file arguments after parsing is complete? In ParseResult, I see there is a tentativeMatch which does have the correct arguments parsed out, but it doesn't seem to be exposed externally. The originalArgs object still has the un-expanded @-file arguments like @/path/to/file.args

Basically given binary --arg @/path/to/file --other_arg @/path/to/second/file, is it possible to get binary --arg expanded_file --other_arg expanded_file? Either as a raw string, or a list of parsed tokens (preferred).

The use-case is to be able to log the actual arguments even if you invoke the binary with a file, and support replayability with a copy/pastable repro command.

@remkop
Copy link
Owner

remkop commented May 26, 2020

Hi, with the current version of picocli this feature does not exist.
We could add a method ParseResult.expandedArgs() that returns the argument list that was actually processed by the parser (so after @file expansion).

Will you be able to provide a pull request for this?

@remkop remkop added type: API 🔌 theme: parser An issue or change related to the parser labels May 26, 2020
@mashlol
Copy link
Contributor Author

mashlol commented May 26, 2020

Sure, I can submit a pull request for this.

@remkop
Copy link
Owner

remkop commented May 27, 2020

This is a nice addition!
Thank you for the PR! Merged and will be included in the next release.

@remkop remkop closed this as completed May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme: parser An issue or change related to the parser type: API 🔌
Projects
None yet
Development

No branches or pull requests

2 participants