click-prompt provides more beautiful interactive options for the Python click library
Project description
click-prompt
click-prompt is a Python library that enhances the functionality of the Click library by providing interactive prompts for user inputs. It features simple prompts to easily prompt users for a single/multi input from a list. It also allows for more advanced prompting such as path completion. This library is inspired by a post on stackoverflow.com. Contributions are welcome! Please send me an e-mail or create a pull request.
Installation
To install click-prompt
, use pip:
pip install click-prompt
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
For more examples see the file example.py.
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
License
This project is licensed under the MIT License. See the LICENSE file for more information.
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
Built Distribution
File details
Details for the file click_prompt-0.6.1.tar.gz
.
File metadata
- Download URL: click_prompt-0.6.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c158c6227a30a803970d08cfcb2b83bcdbc1729bf0189c03981a2db28ac1ef04 |
|
MD5 | aacda794b6bc0e9e5741eaf4391a43b2 |
|
BLAKE2b-256 | 15da16077956c06611745554be1836747a66e0910fdf7faf8dfe9531b6606ff2 |
File details
Details for the file click_prompt-0.6.1-py3-none-any.whl
.
File metadata
- Download URL: click_prompt-0.6.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22c5d137b6febe8dbbb11705e63a79222d3432de7a4cdf0d247f712139fc1b8a |
|
MD5 | 78ce7b65189877618cb947be3033ff77 |
|
BLAKE2b-256 | 15df3b4c6278ebcb3ce7f42c36c0b907d1221d054bcbf82b5a94569e4b82fab7 |