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-1.0.5.tar.gz
(12.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
petcmd-1.0.5-py3-none-any.whl
(14.6 kB
view details)
File details
Details for the file petcmd-1.0.5.tar.gz.
File metadata
- Download URL: petcmd-1.0.5.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
993f8ab6801bd94deab3765b7496aed6aadbdab4fca91886d5a63784e2467251
|
|
| MD5 |
eb4b75ceb99aee73e69202042377200d
|
|
| BLAKE2b-256 |
bedc7a4e467c337ead6baaad833b39eeba3ee49a7c021a74b4d8d5544e1ce52f
|
File details
Details for the file petcmd-1.0.5-py3-none-any.whl.
File metadata
- Download URL: petcmd-1.0.5-py3-none-any.whl
- Upload date:
- Size: 14.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa1891123e5bcbe6787905a15f119ef72a87cfd867c64261a10269e4d02fece
|
|
| MD5 |
e911c5fb313a173032a454eb3adc1fb5
|
|
| BLAKE2b-256 |
482f653fc03dd3b224669d176249ed091894f74bd0749c0b956daa4c32f14f39
|