-
Notifications
You must be signed in to change notification settings - Fork 21
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
A way to prevent parsing of options after positionals #359
Comments
So I can better understand the problem - what's the motivation for that? |
As illustrated above, it's to pass all
https://docs.rs/bpaf/latest/bpaf/fn.any.html#use-any-to-capture-the-remaining-arguments |
I see. That's a bit tricky, my usual approach is to have different flags between inner and outer commands. To apply the restriction you want parser needs to run on arguments in order they are given on a command line, at the moment it runs in order they are specified in your parser. I need to think about an efficient way to allow this, might take some time. |
|
I have identified another (perhaps related) issue with To illustrate: Given (the same program as before, but updated):
If I do:
The second unconsumed The code is here for your reference: https://github.com/teohhanhui/krun/blob/283a1f716f8c2078e9fbe6a4f2174bcba38b559e/crates/krun/src/cli_options.rs |
I got some ideas how to implement it and for now I'm done messing with |
I pushed a let option_parsers = xxx.start_adjacent();
let tail = any::<OsString, _, _>("TAIL", Some).many();
let parser = construct!(option_parsers, tail) I'm planning to release a new version with it in a few days after covering some of other remaining issues. |
This is addressing the original issue, right? But what about the other issue I found? 🙈 |
I'm looking into fixing it as well.
…On Tue, Jul 2, 2024, 16:33 Teoh Han Hui ***@***.***> wrote:
This is addressing the original issue, right? But what about the other
issue I found? 🙈
—
Reply to this email directly, view it on GitHub
<#359 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAQFI3PKKCKNBE72SYLC7TZKMFDNAVCNFSM6AAAAABG4OC75KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBUGM3DENZRHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Perhaps related to #302, I'd like to be able to prevent parsing of options after positionals.
Given:
If I do:
It should not be parsed as the
--help
option.Sure, it's possible to just add
--
but that's not always user-friendly.The text was updated successfully, but these errors were encountered: