bchao1 / bullet

🚅 Interactive prompts made simple. Build a prompt like stacking blocks.
https://pypi.org/project/bullet/
MIT License
3.55k stars 113 forks source link

Option to return index/position of selected option rather than its value #57

Closed askvictor closed 4 years ago

askvictor commented 4 years ago

Sort of similar to https://github.com/Mckinsey666/bullet/issues/27 but slightly simpler - it would be nice to have the option to get back the index of the selected option rather than it's value. This could be an argument to the launch method. For example, if the choices are ['yellow', 'red', 'green'], and I call something like cli.launch(return_index=True) then if the user selects 'yellow' it would return a value of 0.

askvictor commented 4 years ago

PR created: https://github.com/Mckinsey666/bullet/pull/58