-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Interactive prompts #1471
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
Comments
this would be amazing. If this isn't desired for the core library, are there any hooks that would allow one to implement outside the library? i see that some work was already done in #235. Looks like this was mostly complete, but there some questions about it being a blocking API. I can imagine some use cases where this would be a problem, but I can imagine a lot more where it's a non-issue.
non-blocking APIs smells like a complete rewrite of the library to me (everything async, blocking api which wraps the async behind a feature flag). |
could this be resolved by simply adding a hook to set a default using a closure? something like
then passing your prompt function into this method. I'm not too familiar with this codebase, does this sound like a reasonable solution? @kbknapp |
i guess for symmetry, you'd have to do something similar for the other corresponding methods
How are conflicting arguments handled elsewhere in Clap? should it be an enum, such that if you use both methods, the second one clobbers the first? or should they be separate fields with a |
you would also want a
|
I have worked on https://github.com/termapps/enquirer this week. Either a hook fn or a matches fn, this library can easily provide them. IMO, the prompts shouldn't be in the core. Hooks? yes but not prompts. |
Closing in favor of #1634 , they are about the same thing anyway |
Hello, I have a small command line program which I always forget the options for and have to use --help for every time. After looking at darcs recently it occurred to me that it would be nice to get a series of prompts when clap can't parse the input.
For example, let's say I'm writing a simple
log
program, with the following usage:If I type
log
with no arguments, it would be good to be given something like the following:I realise this whole feature isn't necessarily something you want baked into the core, perhaps an external crate, perhaps a feature. Either way, I'm happy to write this, but I'm not sure how best to tap into the parser.
I think it would be useful if clap::App had a
get_matches_from_fns
function with a signature like thisThen those getters would in this case prompt the user for the input
The text was updated successfully, but these errors were encountered: