A (not quite) flexible command framework
Project description
Installation
pip install --upgrade cmdtools-py
install latest commit from GitHub
pip install git+https://github.com/HugeBrain16/cmdtools.git
Basic example
import asyncio
import cmdtools
@cmdtools.callback.add_option("message")
def send(ctx):
print(ctx.options.message)
@send.error
def error_send(ctx):
if isinstance(ctx.error, cmdtools.NotEnoughArgumentError):
if ctx.error.option == "message":
print("Message is required!")
cmd = cmdtools.Cmd('/send hello')
asyncio.run(cmdtools.execute(cmd, send))
Links
PyPI project: https://pypi.org/project/cmdtools-py
Source code: https://github.com/HugeBrain16/cmdtools
Issues tracker: https://github.com/HugeBrain16/cmdtools/issues
Documentation: https://cmdtools-py.readthedocs.io/en/latest
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
cmdtools_py-3.0.4.tar.gz
(10.4 kB
view details)
Built Distribution
File details
Details for the file cmdtools_py-3.0.4.tar.gz
.
File metadata
- Download URL: cmdtools_py-3.0.4.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.10.9 Linux/6.2.3-273-tkg-pds
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 080ad3030e5a12443ee419767ac442d1d8398eba774459872a1caa3cfe54ddb2 |
|
MD5 | fb6e8bd5dd915592b2a32c0957a5a32f |
|
BLAKE2b-256 | 20c12e68e4012ea39a402d137d26e509c89b865008256dc085245bb0afc45d51 |
File details
Details for the file cmdtools_py-3.0.4-py3-none-any.whl
.
File metadata
- Download URL: cmdtools_py-3.0.4-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.0 CPython/3.10.9 Linux/6.2.3-273-tkg-pds
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eacce3ae4eb2366e959720c3d4e860c536806f4c35293c049e50eab9306f75d2 |
|
MD5 | 8ccbfa8451e646dc5668eeb52a8c7914 |
|
BLAKE2b-256 | 3d5288b26ae4120ad677e3982d2b6c2a7c1e56689b8c8eb962e1325fd0d39b9b |