Simple Python Prompt
Project description
Python Zompt
zompt is library for generating user input prompts for Python clis.
Zompt features
- Text input prompt
- Multiple choice prompt (using arrow keys)
Installation
pip install zompt
Getting Started
Input Prompt
The most simple example of the Input Prompt would look like this:
if __name__ == "__main__":
print("Example prompt (type some text): ")
input_prompt = InputPrompt()
result = input_prompt.run()
print()
print("You typed: " + result)
Multiple Choice Prompt
The most simple example of a mupltiple choice prompt would look like this:
if __name__ == "__main__":
if(len(sys.argv) < 2):
print("No arguments given, include at least two commandline arguments.")
sys.exit(1)
options = []
for index in range(1, len(sys.argv)):
arg = sys.argv[index]
options.append(arg)
print("Select an option (use arrow keys to change selection, press enter when done): ")
arrow_selection_prompt = ArrowSelectionPrompt(options)
result = arrow_selection_prompt.run()
print()
print()
print("You selected: " + result)
Philosophy
Sometimes for CLIs less is more. Providing users with a simplified prompting mechanism will help guide them through complex scenarios but with an easy to use interface.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
zompt-0.1.0-py3-none-any.whl
(5.2 kB
view hashes)