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.6. It has a few dependencies:
- click >= 7.0
- validators
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
File details
Details for the file click-params-0.1.1.tar.gz
.
File metadata
- Download URL: click-params-0.1.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c89893939fea12d83fcc7bfe1f62cca3c1ae9145d3663d4ab9767764f690e93 |
|
MD5 | 5fffb279e1540bf0a505bda7b3b1391c |
|
BLAKE2b-256 | 5636d5cb2aed5301df958062e453190dcfdf17a2454699a985eff2fe50884631 |
File details
Details for the file click_params-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: click_params-0.1.1-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.0 CPython/3.8.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9f3dd780f7a00f0b571050520c27af4dde0da4d9d1e5fab714d966ded94e962 |
|
MD5 | 46f74ca6bf1659b839abd8cbb9474b21 |
|
BLAKE2b-256 | 589fc549dd75b3329cbf8176a0c7fc298a38f6eb694830644709caf74d44988d |