click-prompt provides more beautiful interactive options for the Python click library
Low maintenance activity. Last release 11 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and release cadence.
pip install click-promptREADME as published on PyPI with version 0.7.1.
click-prompt
click-prompt extends the Click command-line interface library by adding intuitive, interactive prompts. It's perfect for building more user-friendly CLI tools.
This library is inspired by a post on stackoverflow.com.
Contributions are welcome! Open a pull request or submit an issue.
Installation
To install click-prompt, use pip:
pip install click-prompt
Usage
Here’s a basic example using the choice_option decorator:
import click
from click_prompt import choice_option
@click.command()
@choice_option('--fruit', type=click.Choice(['Apples', 'Bananas', 'Grapefruits', 'Mangoes']))
def select_fruit(fruit: str):
"""Prompt user to select a fruit from a list."""
print(f"You selected: {fruit}")
if __name__ == '__main__':
select_fruit()
Example
For more examples see the file example.py.
