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.0.tar.gz
.
File metadata
- Download URL: click-params-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bca3ffb96296adb700cd9136e8f5b6d641f9e4c3aec2795b83c8394ef3e0b8f2 |
|
MD5 | abd2ec6e0c576148ae9f5d7cf4d9e3ba |
|
BLAKE2b-256 | 2494d917eea281d6fd87e8008293b778072f6311418254344b8d4de6bccce29a |
File details
Details for the file click_params-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: click_params-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 623b77c657a6e9f4ad6bfda7fa472aa3647dff1d391da4aa274060fe06f7d411 |
|
MD5 | 8133ad932ca3835749492bdae13896b2 |
|
BLAKE2b-256 | 964252802f3bfac3ec73f782372d5da410a7fc16d923dbb154081199cba7186e |