Crispy is a simple command line argument parser, ready to be integrated to any project of any size!
Project description
crispy
![Upload Python Package](https://pypi-camo.freetls.fastly.net/351eaabc0168297d82ac22ef75875c0d87b4db56/68747470733a2f2f6769746875622e636f6d2f667962782f6372697370792f616374696f6e732f776f726b666c6f77732f666c6f772d7075626c6973685f7061636b6167652e796d6c2f62616467652e7376673f6272616e63683d6d61696e)
crispy
is my take on parsing command-line arguments. It is a dead simple tool that allows you to define your own keys for systematically gathering variables.
In just 5 simple steps, you can start parsing any complicated user input into a dictionary—simple and predictable. It can't get more versatile than that, can it?
Capabilities
Feature | Support | Version |
---|---|---|
String, integer, float, and boolean type arguments | ✅ | v1.0.0 |
Custom exceptions for tracking user errors in input | ✅ | v1.0.0 |
Custom subcommands | ✅ | v2.0.0 |
Treating quoted strings as single input in parse_string() |
TO DO | ... |
Usage
- To start using
crispy-parser
in your projects, install it from PyPI:
$ pip install crispy-parser
- Import the parser into your source code:
from crispy.crispy import Crispy
- Add your arguments:
c = Crispy()
c.add_variable("name", str)
c.add_variable("age", int)
c.add_variable("salary", float)
- Throw any user-inputted string or argument list at it!
result = c.parse_string("--name John -a=21 --salary=30000.45")
print(result)
{'name': 'John', 'age': 21, 'salary': 30000.45}
Or parse sys.argv
:
arguments = c.parse_arguments(sys.argv[1:])
print(arguments)
{'message': 'message.txt', 'targets': 'targets.txt', 'url_format': 'api.txt'}
Contributing
I welcome contributions to enhance and improve this library! Whether you want to fix a bug, add a new feature, or suggest an improvement, your contributions are highly appreciated.
Just so you know, by contributing to this project, you agree to license your contributions under the same license governing this library. If you're unsure or have questions about the contribution process, please get in touch with me by opening an issue.
Credits
Feel free to contact me for collaboration on anything!
Ferit Yiğit BALABAN, <fyb@fybx.dev>
My Website • My Bento • X • LinkedIn
2023
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
Built Distribution
Hashes for crispy_parser-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb64406dc9318d4a8bfeb363affac430aa46d23e53cca5d7c72fc00a29727799 |
|
MD5 | 19b239157d5c628417371fa0e1350d8d |
|
BLAKE2b-256 | 1c461143cfc88643a129523419b9bf56840b62b7de921d6f7e996505c08bc733 |