Library for creating a command line tools
Project description
petcmd
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
Release history Release notifications | RSS feed
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)
Built Distribution
petcmd-0.2.10-py3-none-any.whl
(10.1 kB
view hashes)