click-prompt
click-prompt provides more beautiful interactive options for the Python click library. The library is inspired by a post on stackoverflow.com
Usage
The library can be used with decorators:
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):
print(fruit)
Example
Available Decorators
Here is a list of available decorators that can be used with the click library
instead of a click.Option
decorator
-
choice_option
: Select a single item out of a list. Use the parametermultiple=True
to select multiple items out of a list -
confirm_option
: Yes/No confirmation -
filepath_option
: Select a file path with auto completion -
auto_complete_option
: Auto completion given a list
for every click.Option
there is also a click.Argument
implementation