-
Notifications
You must be signed in to change notification settings - Fork 25
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
Allow input to be a positional argument #375
Comments
I pretty much agree that some simplification can be beneficial. Actually what you ask for is to make named arguments positional ones (see Subcommands in Relevant cases:
|
I think this is totally reasonable. I'd like to figure out a way to do this without changing the existing usage, since I think it can be easier to remember what's what using a short or long flag. This isn't supported directly by clap, the argument parsing library that intermodal uses, but I opened an issue to request an easy way to do this: clap-rs/clap#1820 For now, I think this can be accomplished by using arg groups, or making the positional option conflict with the flag option. |
Allow taking the `--input` argument to `imdl torrent create` as a positional argument, so the following now works: imdl torrent create foo Taking input by flag `--input` still works. type: changed fixes: - #375
Input can now be passed to `imdl torrent verify` without a flag: imdl torrent verify foo.torrent Passing input by flag continues to work. type: changed fixes: - #375
The shell can now be passed to `imdl completions` without a flag: imdl completions bash Passing the shell by flag continues to work. type: changed fixes: - #375
Input can now be passed to `imdl torrent show` without a flag: imdl torrent show foo.torrent Passing input by flag continues to work. type: changed fixes: - #375
Input can now be passed to `imdl torrent show` without a flag: imdl torrent show foo.torrent Passing input by flag continues to work. type: changed fixes: - #375
This is done! The following commands can take their main input as a positional argument:
The old flags still work, and will continue to work going forward, so there's no breakage with existing usage. I just released v0.1.7, which includes this change. |
Hi, thank you for this tool.
I think forcing --input PATH is a little too verbose for most use cases.
Most other tools out there simply allow a named argument as well as a long option for it.
Currently, this fails:
error: Found argument 'myfiles.torrent' which wasn't expected, or isn't valid in this context
USAGE: imdl torrent show --input <PATH>
structopt should support using
name = "PATH"
, however I don't know how it behaves with subcommands.The text was updated successfully, but these errors were encountered: