A bunch of useful click parameter types
Project description
click-params
A bunch of useful click parameter types.
Why?
I often find myself wanting to use a click parameter able to handle list of strings, so I decide to put this in a library and I ended adding more parameter types that can be useful for various scripts including network, mathematics and so on.
Installation
pip install click-params
click-params starts working from python 3.8. It has a few dependencies:
- click >= 7.0
- validators
- deprecated
Usage
import click
from click_params import Ipv4AddressListParamType
@click.command()
@click.option('-a', '--addresses', help='list of ipv4 addresses', prompt='list of ipv4 addresses to reserve',
type=Ipv4AddressListParamType())
def pool(addresses):
click.echo('reserved ips:')
for ip in addresses:
click.echo(ip)
$ pool --addresses='192.168.1.1,192.168.1.14'
reserved ips:
192.168.1.1
192.168.1.14
You can change the default separator "," by passing it when initializing the parameter type.
Documentation
Documentation is available at https://click-params.readthedocs.io/en/latest/.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file click_params-0.5.0.tar.gz.
File metadata
- Download URL: click_params-0.5.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5fe97b9459781a3b43b84fe4ec0065193e1b0d5cf6dc77897fe20c31f478d7ff
|
|
| MD5 |
6ff6f6281a98db60406d75653b68ac63
|
|
| BLAKE2b-256 |
0c4957e60d9e1b78fd21fbaeda0725ac311595c35d8682dace6b71b274a43b90
|
File details
Details for the file click_params-0.5.0-py3-none-any.whl.
File metadata
- Download URL: click_params-0.5.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbb2efe44197ab896bffcb50f42f22240fb077e6756b568fbdab3e1700b859d6
|
|
| MD5 |
bfbad0b1a36e7321e1d27847b1f1f485
|
|
| BLAKE2b-256 |
cac7a04832e84f1c613194231a657612aee2e377d63a44a5847386c83c38bbd6
|