Rust Clap inspired command line argument parser.
Project description
clap-py
Command Line Argument Parser for Python
Licensed under Apache 2.0.
About
A full-featured, fast Command Line Argument Parser for Python
For more details, see:
Quick Start
pip install clap_python
from clap_py import App, Arg
app = (
App()
.version("0.1.0") # Version of the app.
.arg_required_else_help(True) # If no args passed show help message.
.arg(Arg("--name", "-n").help("Name of the person to greet").required(True))
.arg(
Arg("--count", "-c")
.help("Number of times to greet")
.default(1)
.value_parser(int) # tell the parser to cast arg to int.
)
)
if __name__ == "__main__":
args = app.parse_args()
for _ in range(args["count"]):
print(f"Hello {args['name']}!")
Positionals
from clap_py import App, Arg
if __name__ == "__main__":
args = App().arg(Arg("names").multiple_values(True)).parse_args()
print(f"names: {args['names']}")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clap_python-0.1.0.tar.gz
(28.4 kB
view details)
Built Distribution
File details
Details for the file clap_python-0.1.0.tar.gz
.
File metadata
- Download URL: clap_python-0.1.0.tar.gz
- Upload date:
- Size: 28.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9bf63eedcc1506490b94c1b13a126c79d580ebccb20d74aabeb088d09a7a3c1d |
|
MD5 | c0a55732d597e7add704ca8ed234cea4 |
|
BLAKE2b-256 | 1bb096ff9d94d42628e83dfd6b333916b6a711a5c3a288e4fa9fd04290dda528 |
File details
Details for the file clap_python-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: clap_python-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b6cec1a92987803574f7a3e1751ebb25a82489d309756cbeeacdd4ea123fa3 |
|
MD5 | bc45547d9a87c3d49a401cee4599ae39 |
|
BLAKE2b-256 | 00b8b33400cf74ed46606be3f5f4ac6cff8f8ee40163c29f5775dc56507b66b3 |