Skip to main content

Library for creating a command line tools

Project description

petcmd

PyPI - Python Version PyPI - Version Documentation Status PyPI - License Downloads

Installation

petcmd can be installed with pip:

python -m pip install petcmd

You can also download the project source and do:

pip install .

Dependencies

petcmd was created as a lightweight package, so there are no dependencies.

Examples

from petcmd import Commander

commander = Commander()

@commander.command("calc")
def calculate(a: int, b: int, operator: str = "+"):
	print(eval(f"{a} {operator} {b}"))

if __name__ == "__main__":
	commander.process()
$ python app.py calc 1 2
3
$ python app.py calc 10 2 /
5.0
$ python app.py calc 10 2 -o /
5.0
$ python app.py calc 10 2 --operator /
5.0
$ python app.py calc -a 10 -b 2 --operator /
5.0

Documentation

Documentation is available at https://petcmd.readthedocs.io/en/latest/

Testing

python -m tests

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

petcmd-0.2.10.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

petcmd-0.2.10-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page