Werkzeug-style commands.
## Usage
```
from commandlet.parser import Parser
p = Parser()
@p.command('test', 'test <int:times> <str:string>')
def do_test(times, string):
"""Test a certain number of times."""
for n in range(times):
print('[%d]: %s' % (n, string))
p.handle_command('test 4 Hello world.')
```
As you can see, you can decorate functions with the Parser.command decorator to make them callable. They should all be given a name (used for pretty-printing mainly), and an argument string, which looks very similar to those seen in command line programs... And [Werkzeug](https://palletsprojects.com/p/werkzeug/).
You can also add extra filters:
```
@p.filter('reverse')
def do_reverse(text):
return (text, ''.join(reversed(text)))
@p.command('reverse', 'reverse <reverse:string>')
def reverse_command(string):
original, new = string
print('Reversing %r gives %r.' % (original, new))
```
You can see the full list of filters by examining the Parser.filters dictionary. By default, str, int, and float are supported.
Metadata
Release files for commandlet 0.4.4
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 |
|---|---|---|---|---|
| commandlet-0.4.4.tar.gz | 11.6 kB | Without provenance | Details for commandlet-0.4.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| commandlet-0.4.4-py3-none-any.whl | Python 3 | none | any | Details for commandlet-0.4.4-py3-none-any.whl |
Total release size: 23.1 kB
Release files / commandlet-0.4.4.tar.gz
| Download URL | commandlet-0.4.4.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae6b01921655309c4909e9b7f940707d1ef79f390d5d4cffdf5186f21ad168ba
|
|
BLAKE2b-256 checksum How to use checksums |
ff63c7adc68cdb07f40691e2d37f7f92722d4cc5038575b7a93f7e625060a828
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Release files / commandlet-0.4.4-py3-none-any.whl
| Download URL | commandlet-0.4.4-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
478a68cd85437727ff2598ded3e49a4b49b2aaab8515a5d652748c2061f663aa
|
|
BLAKE2b-256 checksum How to use checksums |
e3e55d83080adf8ff7a45403dcfa84f1d18c81a697432704643befb0cf178bcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
|
Security for commandlet 0.4.4
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.