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.3.0.tar.gz
(8.5 kB
view details)
Built Distribution
File details
Details for the file petcmd-0.3.0.tar.gz
.
File metadata
- Download URL: petcmd-0.3.0.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e085ee5b75e55a709170aa001789891dc721a8984f90b4d1902b0d4e69233f39 |
|
MD5 | c55f7e9ac58004fd0fd59c8e0147b36d |
|
BLAKE2b-256 | ed384dc8364237dcc61670837595b73a97c9120df14652b8adff005bdf940e1d |
File details
Details for the file petcmd-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: petcmd-0.3.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 483bcbac69d410ab3d3faaa4ff5a7c69c1c1f9f5c53cd622e6866148e2fd8d49 |
|
MD5 | bb20e5cd9dc7cf0203511c1c3aef903a |
|
BLAKE2b-256 | 45f6389576bc924a63e47522b1e53cee1ca842d633a0c0d80c2d99dea5818f96 |