cmd2 icon indicating copy to clipboard operation
cmd2 copied to clipboard

argparse parameter wizard

Open anselor opened this issue 5 years ago • 8 comments

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 avatar Jun 09 '20 20:06 anselor

@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.

tleonhardt avatar Jun 10 '20 01:06 tleonhardt

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 avatar Jun 10 '20 18:06 anselor

@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?

tleonhardt avatar Jun 10 '20 18:06 tleonhardt

Yes. Apparently that's too hard.

anselor avatar Jun 10 '20 18:06 anselor

🤯 Get better users?

tleonhardt avatar Jun 10 '20 19:06 tleonhardt

@anselor Is this something you are still interested in? If not I'm going to close this issue.

tleonhardt avatar Mar 03 '21 01:03 tleonhardt

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.

jayrod avatar Feb 02 '22 03:02 jayrod

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.

prot0man avatar Feb 21 '22 17:02 prot0man

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.

tleonhardt avatar Jan 28 '23 17:01 tleonhardt