Thanks for this awesome framework! 鉂わ笍
Click is my Goto tool for writing Command Line applications.
I have problem/feature request which I would like to share.
Abstract: Way for developer to customize user prompt according to the application's need.
Currently, there are two ways to prompt the user for input, namely:
click.prompt: Manually ask for user inputclick.confirm: To ask if a user wants to continue with an actionThese options are rather limited with regards to UI.
I, personally, find that methods which increase the interaction between the user and the application can be beneficial to the framework.
Let me explain my proposal with a use case scenario I am facing in one of my applications.
Suppose the application needs the user to choose from a list of options.
It is probable that one can try the Choice type as a workaround for success.
But this does not perform satisfactorily most of the times because:
Current Behaviour
$ pyword search <random_word>
We cannot find the <random_word>.
Alternates:
1. <word1>
2. <word2>
3. <word3>
Enter the index number of the correct alternate:
Proposed Behaviour
$ pyword search <random_word>
We cannot find the <random_word>.
Chose one of the alternates from the interactive prompt using arrow keys:
[x] <word1>
[ ] <word2>
[ ] <word3>
[ ] None of the above
After a bit of research, I found that we can create something like promptui in GoLang to support customizable prompts for option and selection type inputs. This way we can create a common interface for interaction between the user and the application. If this sounds like a good idea, I would love to perform a Proof-Of-Concept and open it for review.
A good module for this I have found is inquirer https://pypi.python.org/pypi/inquirer
Thanks @stopthatcow; this looks great.
How about we create a community wiki that aggregates all such CL utilities (such as Halo, inquirer) which can be used in conjunction with Click?
Not a bad idea. I am not a owner of this repo however. I bet if you started one in markdown thought @untitaker or @mitsuhiko would merge it.
This is outside the current scope of Click. I do not want to add a list of external libraries at this time as such lists are difficult to maintain.
Most helpful comment
A good module for this I have found is
inquirerhttps://pypi.python.org/pypi/inquirer