PyCommandApp
library to create a commandline application easily
Index
Installation
python3 -m pip install commandapp
View on pypi.org
Usage
Code
from commandapp import CommandApp
app = CommandApp()
@app.register
def hello(name: str):
r"""
prints hello `name`
"""
print("Hello {}".format(name))
@app.register(name="print")
def cmd_print(text: str):
r"""
print what he should say
"""
print(text)
app.run()
Console
>> py myapp.py
usage: -c [-h] {hello,print} ...
>> py myapp.py -h
usage: -c [-h] {hello,print} ...
optional arguments:
-h, --help show this help message and exit
command:
{hello,print} available commands
hello prints hello `name`
print print what he should say
>> py myapp.py hello
usage: -c hello [-h] name
hello: error: the following arguments are required: name
>> py myapp.py hello "python"
Hello python
>> py myapp.py print "This package is awesome"
This package is awesome
Tips
Keyword-Parameter
Code
from commandapp import CommandApp
app = CommandApp()
@app.register
def a(param: str):
print([param])
@app.register
def b(*, param: str):
print([param])
app.run()
Console
>> py myapp.py a "Value"
["Value"]
>> py myapp.py b "Value"
b: error: the following arguments are required: --param
>> py myapp.py b --param "Value"
["Value"]
Metadata
Release files for commandapp 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| commandapp-0.2.1.tar.gz | 3.0 kB | Without provenance | Details for commandapp-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| commandapp-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for commandapp-0.2.1-py3-none-any.whl |
Total release size: 5.8 kB
Release files / commandapp-0.2.1.tar.gz
| Download URL | commandapp-0.2.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1c834da2ff02961bbd7af647dd2e50665f641ac873e04cfadeb5ec10484dbcef
|
|
BLAKE2b-256 checksum How to use checksums |
ab21e557902825cf97d53d723a3693b6f8afd23fe40796fcb8994f38b259c62f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
|
Release files / commandapp-0.2.1-py3-none-any.whl
| Download URL | commandapp-0.2.1-py3-none-any.whl |
|---|---|
| Size | 2.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f356872c76cba48fc1c018f66dd6b30e7cc336a5bfc61653516bb5521a0199d6
|
|
BLAKE2b-256 checksum How to use checksums |
261510728bbe7e71d1746494c30bb2c9864b3e24f780b7adb6943d49e14e5aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4
|
Security for commandapp 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.