cmd2
cmd2 copied to clipboard
argparse parameter wizard
Initially I was going to submit an enhancement ticket to add an optional parameter wizard that, for some commands, can walk the user through all of the required fields and present a menu for optional fields.
Thinking this through some more, I think the enhancements we've made to argparse are generally useful outside of cmd2. What I want to do is to take our current enhanced argparse and automatic completion generation and move it into a separate stand-alone project. Then, in than separate project, implement a wizard feature. Once that's been ironed out, we can can switch cmd2 over to use this library.
@anselor I'm not sure I fully grok what you are aiming for here, but I'd say lets cross this bridge when you have that stand-alone project working with the new features you want implemented.
Some of our users have expressed a desire for the tool to walk them through entering in arguments with a sequence of prompts for input.
What I'm proposing is to generate the prompts based on the argparse definition for a command and show a menu interface for configuring optional parameters.
@anselor Are your users aware that while they are entering a command and they hit <Tab><Tab>, our argparse support will give them a good hint for what should be entered next?
Yes. Apparently that's too hard.
🤯 Get better users?
@anselor Is this something you are still interested in? If not I'm going to close this issue.
I'd like to re-open this issue.. slightly.
https://clig.dev/#ease-of-discovery has some good suggestions for creating great CLI interfaces. One thing that is difficult as an app developer is leading users down the right path. with complex commands.
Discoverable CLIs have comprehensive help texts, provide lots of examples, suggest what command to run next, suggest what to do when there is an error.
Perhaps we can help link cmd examples to do functions like we do with complete_foo functions. and help_foo functions. perhaps a related_cmd_foo function would show up when there are next or related commands to the target command?
it might also be something that gets created as a cmd2 plugin but not sure.
I'd love to see this sort of feature! I've worked on a few applications where I had to do some really ugly things to prompt users for mandatory fields. I think all users could benefit from a mode where the CLI allows a user to enter a command and then provides prompts for mandatory fields (with tab completion) based off of an argparse object. I also wonder if others would also benefit from a plugin that generates a CLI based off of an OpenAPI spec.
Closing very old issue due to inactivity. @anselor if you get the motivation to work on this, feel free to create a new issue or reopen.