Replies: 1 comment
-
|
Yes, the existing And yes, combining the arguments is the current workaround. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Something like the
bashcommand: it has some options e.g. "-e", and some positional argument,fileandmore_args. I want everything afterfileto be supplied tomore_args, even if it looks liks an option .I'm thinking of something like trailing_var_arg + allow_hyphan_values:
The above code works in some cases. If user type "bash a.sh x -e",
more_argsbecomes["x", "-e"].However, if "-e" is the first value, like "bash a.sh -e x", it will be provided to the option instead of positional args. Which makes sense because the
more_argsdoesn't even begin. Users have to type "bash a.sh -- -e x" instead.I can't find anywhere in the document how to achieve my goal. I think it's not possible, according to #5413.
Some workaround would be making
fileandmore_argsa single Vec positioal argument. However there's some drawback e.g. suboptimal help message, unable to provide different parsing rule, etc.So I'm thinking of a new property, something like
disable_options_onward, to add to argumentfile, so that clap knows it should parse everything as positional arguments onward.I'm not sure if this aligns with clap's philosophy. I'd love to provide a PR if you see fit. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions