qr_console
This project is a small console-app builder based on argparse package.
Usage example:
from qr_console import QRConsole, QRCommand
console = QRConsole(hello='hello')
console.add_command(QRCommand('add', lambda a, b: print(a + b), 'sum 2 integers')
.add_argument('a', type=int, help='1st arg')
.add_argument('b', type=int, help='2nd arg'))
console.add_command(QRCommand('sub', lambda a, b: print(a - b), 'differ 2 integers')
.add_argument('-a', type=int, default=0, help='1st arg')
.add_argument('--value', '-v', type=int, help='2nd arg'))
console.add_command(QRCommand('one', lambda v, i: print(v + 1 if i else v - 1), 'change value by 1')
.add_argument('v', type=int)
.add_argument('-i', '--flag', action='store_true', help='set to inc; default is dec')
)
console.run()
Output example:
hello
Type '-h' or '--help' to get more info
Enter commands:
?>-h
usage: PROG [-h] {add,sub,one} ...
positional arguments:
{add,sub,one}
add sum 2 integers
sub differ 2 integers
one change value by 1
optional arguments:
-h, --help show this help message and exit
?>add -h
usage: add [-h] a b
positional arguments:
a 1st arg
b 2nd arg
optional arguments:
-h, --help show this help message and exit
?>one --help
usage: one [-h] [-i] v
positional arguments:
v
optional arguments:
-h, --help show this help message and exit
-i, --i, --flag set to inc; default is dec
?>add 1 2
3
?>sub -a=5 -v=2
3
?>sub --value=5
-5
?>one 5
4
?>one -i 5
6
?>add
the following arguments are required: a, b
?>sub -b=5
unrecognized arguments: -b=5
?>add 1 a
argument b: invalid int value: 'a'
?>
Metadata
Release files for qr-console 1.1.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 |
|---|---|---|---|---|
| qr_console-1.1.1.tar.gz | 4.7 kB | Without provenance | Details for qr_console-1.1.1.tar.gz |
Release files / qr_console-1.1.1.tar.gz
| Download URL | qr_console-1.1.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3bb2b0217367c0196d204beefdd96d3f7b0fc16a2280d0e036c197fd764ea0b1
|
|
BLAKE2b-256 checksum How to use checksums |
d369dfad736768d8c275cf5f6a04e3bc1511218d4608c8d66f688b29cf016b9d
|
| 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.22.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.10
|
Security for qr-console 1.1.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.