Simple tool to parse shell arguments using eval
Project description
ShellArgParser
A simple python tool to parse any arg / kwarg arguments in a manner that is easy to parse for the linux shell.
I don't understand
For example:
./shell_arg_parser.sh --test=something -a -b -no-c
Will print this text:
ARGS_A=1
ARGS_B=1
ARGS_C=0
ARGS_TEST="something"
So running this:
eval $(./shell_arg_parser.sh --test=something -a -b -no-c)
Will parse the args and kwargs as environment variables, handy for use in the shell:
echo $ARGS_TEST # outputs 'something'
Notes:
-somethingis parsed asARGS_SOMETHING=1-no-somethingis parsed asARGS_SOMETHING=0-no_somethingis parsed asARGS_SOMETHING=0- Any
Nonepython value is parsed as0 - A prototype 'pure shell' version of this script can be found in
./ShellArgParser.sh
Getting started
- From pypi:
- As a tool:
uvx ShellArgParser@latest --help - Via uv:
uv pip install ShellArgParser - Via pip:
pip install ShellArgParser
- As a tool:
- From github:
- Clone this repo then
pip install .
- Clone this repo then
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
shellargparser-0.1.0.tar.gz
(15.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shellargparser-0.1.0.tar.gz.
File metadata
- Download URL: shellargparser-0.1.0.tar.gz
- Upload date:
- Size: 15.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03fee3d3a081c9805e88b33d6426469a97441c74287b9a1b42a8835c4c1543e4
|
|
| MD5 |
d8a2eca3fbc1f42744fdc680007ad07f
|
|
| BLAKE2b-256 |
a99dfe8fb837cc0cda4d51030a7a6cdce43c67f93148b964fa99a2ceb9cbb61f
|
File details
Details for the file ShellArgParser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ShellArgParser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33fcc36de71b1ffa3c43f1905f3c16bfc9b6882afcf9fc3b075d48da9530f860
|
|
| MD5 |
d9cbf238b84e3b0da9ff8f39500a105e
|
|
| BLAKE2b-256 |
8bbdcb34e01759e4aac7340f96115194bd8a6b9e887bd91e14abccec2a93b328
|