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-1.0.5.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

petcmd-1.0.5-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

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

Hashes for petcmd-1.0.5.tar.gz
Algorithm Hash digest
SHA256 993f8ab6801bd94deab3765b7496aed6aadbdab4fca91886d5a63784e2467251
MD5 eb4b75ceb99aee73e69202042377200d
BLAKE2b-256 bedc7a4e467c337ead6baaad833b39eeba3ee49a7c021a74b4d8d5544e1ce52f

See more details on using hashes here.

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

Hashes for petcmd-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4aa1891123e5bcbe6787905a15f119ef72a87cfd867c64261a10269e4d02fece
MD5 e911c5fb313a173032a454eb3adc1fb5
BLAKE2b-256 482f653fc03dd3b224669d176249ed091894f74bd0749c0b956daa4c32f14f39

See more details on using hashes here.

Supported by

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