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

miri-script: use a proper CLI arg parsing tool #3592

Open
RalfJung opened this issue May 9, 2024 · 1 comment
Open

miri-script: use a proper CLI arg parsing tool #3592

RalfJung opened this issue May 9, 2024 · 1 comment
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement

Comments

@RalfJung
Copy link
Member

RalfJung commented May 9, 2024

We are currently using ad-hoc hand-written parsers for this, and it's kind of annoying. However, we tried to use clap, and it currently doesn't seem possible: what we'd like to do is that once there is a positional argument, that argument and everything that follows gets collected in Vec -- our flags, like --dep, need to come before all of them.

This is non-standard, as it makes ./miri run foo.rs --dep different from ./miri run --dep foo.rs. But it's kind of necessary as ./miri run (and a bunch of other commands) are wrappers around other, complicated tools for which we want to just forward all flags (including --) without parsing them ourselves.

Using clap here is blocked on clap-rs/clap#5055. But maybe there's another crate we can use?

@RalfJung RalfJung added A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement labels May 9, 2024
@RalfJung
Copy link
Member Author

With #3621, our parser's behavior changed: ./miri run foo.rs --dep and ./miri run --dep foo.rs are now equivalent. However, we'd still like to preserve the -- and forward it to miri (e.g. in ./miri run foo.rs -- arg1 arg2), so we still can't use clap.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dev Area: working on Miri as a developer C-enhancement Category: a PR with an enhancement or an issue tracking an accepted enhancement
Projects
None yet
Development

No branches or pull requests

1 participant