Skip to content

earthobservations/click_params

This branch is 15 commits behind click-contrib/click_params:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7bed8d7 · Feb 19, 2023

History

74 Commits
Jan 1, 2023
Feb 19, 2023
Aug 13, 2022
Feb 19, 2023
Aug 13, 2022
Aug 13, 2022
Aug 13, 2022
Aug 13, 2022
Jan 1, 2023
Feb 19, 2023
Aug 13, 2022
Aug 13, 2022
Aug 13, 2022
Aug 13, 2022
Jan 1, 2023
Feb 19, 2023
Feb 19, 2023
Aug 13, 2022

Repository files navigation

click-params

Pypi version Coverage Status Documentation Status License Apache 2 Code Style

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.7. It has a few dependencies:

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/.

About

Bunch of click parameters to use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%