Flagparse
Flagparse is a library for building modular command-line interfaces with accent on nested commands. This library removes the pain of manually constructing the argument parsing and applying handler for each command, all of this is done by this tiny library.
Installation
pip install flagparse
Usage and documentation
Please see the wiki for basic usage and other documentation of using flagparse.
Here is an example of a simple Flagparse app:
import flagparse
class Sum(flagparse.SubCommand):
"""Sub-command to handle numbers summation."""
name = "sum"
arguments = [
(["integers"],
dict(metavar="INT",
type=int,
nargs="+",
help="integers to be summed")),
]
def handle(self, args: flagparse.Namespace) -> None:
print(sum(args.integers))
class Calc(flagparse.Command):
"""A simple calculator that sums numbers."""
name = "calc"
if __name__ == "__main__":
Calc(subcommands=[Sum]).parse()
How it looks when run:
$ python main.py sum 1 2 3
6
License
The openflow library is distributed under MIT license, therefore you are free to do with code whatever you want. See the LICENSE file for full license text.
Metadata
Release files for flagparse 0.0.3
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 |
|---|---|---|---|---|
| flagparse-0.0.3.tar.gz | 3.9 kB | Without provenance | Details for flagparse-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flagparse-0.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for flagparse-0.0.3-py2.py3-none-any.whl |
Total release size: 8.8 kB
Release files / flagparse-0.0.3.tar.gz
| Download URL | flagparse-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17fd07ce5fbb22e04adf441044cfed488e204af0b674a32d1786e2722f096746
|
|
BLAKE2b-256 checksum How to use checksums |
a8f3e70702c1ab04b0219f01093e6d0f35b534856c8dee38365591cbc682facc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5
|
Release files / flagparse-0.0.3-py2.py3-none-any.whl
| Download URL | flagparse-0.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 4.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
000d71d35e556a30c49515889c0d10b4f9acb4ef398e0452d132f54648230b99
|
|
BLAKE2b-256 checksum How to use checksums |
f756aab593b71df9fbde91e6349875b098e9d8198d79ebe4c4b2749b1959f9b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.5
|
Security for flagparse 0.0.3
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.