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/.
Metadata
Release files for click-params 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| click_params-0.5.0.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| click_params-0.5.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.2 kB
Release files / click_params-0.5.0.tar.gz
| Download URL | click_params-0.5.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fe97b9459781a3b43b84fe4ec0065193e1b0d5cf6dc77897fe20c31f478d7ff
|
|
BLAKE2b-256 checksum How to use checksums |
0c4957e60d9e1b78fd21fbaeda0725ac311595c35d8682dace6b71b274a43b90
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Windows/10
|
Release files / click_params-0.5.0-py3-none-any.whl
| Download URL | click_params-0.5.0-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbb2efe44197ab896bffcb50f42f22240fb077e6756b568fbdab3e1700b859d6
|
|
BLAKE2b-256 checksum How to use checksums |
cac7a04832e84f1c613194231a657612aee2e377d63a44a5847386c83c38bbd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Windows/10
|