click-prompt provides more beautiful interactive options for the Python click library
Project description
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 in two ways: 1) as decorator, or 2) as type parameter.
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)
As class
import click
from click_prompt import ChoiceOption
@click.command()
@click.option('--fruit',
type=click.Choice(['Apples', 'Bananas', 'Grapefruits', 'Mangoes']),
cls=ChoiceOption)
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 listconfirm_option
: Yes/No confirmationfilepath_option
: Select a file path with auto completionauto_complete_option
: Auto completion given a list
for every click.Option
there is also a click.Argument
implementation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
click-prompt-0.5.1.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file click-prompt-0.5.1.tar.gz
.
File metadata
- Download URL: click-prompt-0.5.1.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.2 Linux/5.10.0-16-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b01d5e3e79867444dd235c65c961f0b8b7cf467493e7a584f671dfec78f908d9 |
|
MD5 | ff3416f387a37c33cbf0fc86722c0f0e |
|
BLAKE2b-256 | 1dfe339061d11f2905502440612eaaf42cbb442e9416c453c836888023b05cfc |
Provenance
File details
Details for the file click_prompt-0.5.1-py3-none-any.whl
.
File metadata
- Download URL: click_prompt-0.5.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.13 CPython/3.9.2 Linux/5.10.0-16-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17e876f30861dac10703b482c7eac17be5838f5d4fb33b52916ba32414a0ead4 |
|
MD5 | 2f0dc1e95b747598d4e5a6a95a00794c |
|
BLAKE2b-256 | df26f0dca1663ec06838f8676835b6c1edce47e194ed533b813ef700023445da |