ShellArgParser


NameShellArgParser JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://github.com/thiswillbeyourgithub/ShellArgParser
SummarySimple tool to parse shell arguments using eval
upload_time2024-12-04 14:36:24
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseGPLv3
keywords shell zsh bash arguments args kwargs parser tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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:
```sh
uvx ShellArgParser@latest a_file --test=something -a -b -no-c another_file
```
Will print this text:
```sh
ARGS_1="a_file"
ARGS_2="another_file"
ARGS_TEST="something"
ARGS_A=1
ARGS_B=1
ARGS_C=0
```

So running this:
```sh
eval $(uvx ShellArgParser@latest --test=something -a -b -no-c)
```
Will parse the args and kwargs as shell environment variables, handy for use in the shell:
```sh
echo $ARGS_TEST  # outputs 'something'
```

## But why would you make this?
Handling user arguments are a major annoyance for me in shell, and in python using `fire` makes it a breeze, so it's is a great way to avoid reinventing the wheel.
Hence, when writing a small shell script, using a python cli tool oneliner makes is a real time saver for me.

## Notes:
- `-something` is parsed as `ARGS_SOMETHING=1`
- `-no-something` is parsed as `ARGS_SOMETHING=0`
- `-no_something` is parsed as `ARGS_SOMETHING=0`
- Any `None` python value is parsed as `0`
- A prototype 'pure shell' version of this script can be found in `./ShellArgParser.sh`

# Getting started
* From pypi:
    * As a uv tool: `uvx ShellArgParser@latest --help`
    * Via uv: `uv pip install ShellArgParser`
    * Via pip: `pip install ShellArgParser`
* From github:
    * Clone this repo then `pip install .`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/thiswillbeyourgithub/ShellArgParser",
    "name": "ShellArgParser",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "shell, zsh, bash, arguments, args, kwargs, parser, tool",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4a/1d/52c3374bc0354cd68e0fa286951f75af0d7db841324d10590877dc58ca91/shellargparser-0.2.3.tar.gz",
    "platform": null,
    "description": "\n# ShellArgParser\nA simple python tool to parse any arg / kwarg arguments in a manner that is easy to parse for the linux shell.\n\n## I don't understand\nFor example:\n```sh\nuvx ShellArgParser@latest a_file --test=something -a -b -no-c another_file\n```\nWill print this text:\n```sh\nARGS_1=\"a_file\"\nARGS_2=\"another_file\"\nARGS_TEST=\"something\"\nARGS_A=1\nARGS_B=1\nARGS_C=0\n```\n\nSo running this:\n```sh\neval $(uvx ShellArgParser@latest --test=something -a -b -no-c)\n```\nWill parse the args and kwargs as shell environment variables, handy for use in the shell:\n```sh\necho $ARGS_TEST  # outputs 'something'\n```\n\n## But why would you make this?\nHandling user arguments are a major annoyance for me in shell, and in python using `fire` makes it a breeze, so it's is a great way to avoid reinventing the wheel.\nHence, when writing a small shell script, using a python cli tool oneliner makes is a real time saver for me.\n\n## Notes:\n- `-something` is parsed as `ARGS_SOMETHING=1`\n- `-no-something` is parsed as `ARGS_SOMETHING=0`\n- `-no_something` is parsed as `ARGS_SOMETHING=0`\n- Any `None` python value is parsed as `0`\n- A prototype 'pure shell' version of this script can be found in `./ShellArgParser.sh`\n\n# Getting started\n* From pypi:\n    * As a uv tool: `uvx ShellArgParser@latest --help`\n    * Via uv: `uv pip install ShellArgParser`\n    * Via pip: `pip install ShellArgParser`\n* From github:\n    * Clone this repo then `pip install .`\n",
    "bugtrack_url": null,
    "license": "GPLv3",
    "summary": "Simple tool to parse shell arguments using eval",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://github.com/thiswillbeyourgithub/ShellArgParser"
    },
    "split_keywords": [
        "shell",
        " zsh",
        " bash",
        " arguments",
        " args",
        " kwargs",
        " parser",
        " tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "667834fa9dab92ce3a15585a8ea2ba6e81ba787238e39c30fa8d67c786701955",
                "md5": "b281408ccba44767fa9ca73dbcd64912",
                "sha256": "1cf9853d8805611dc2323632a9f32d471ad09852d7733a2917cc0d19c982fcd1"
            },
            "downloads": -1,
            "filename": "ShellArgParser-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b281408ccba44767fa9ca73dbcd64912",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15863,
            "upload_time": "2024-12-04T14:36:21",
            "upload_time_iso_8601": "2024-12-04T14:36:21.863221Z",
            "url": "https://files.pythonhosted.org/packages/66/78/34fa9dab92ce3a15585a8ea2ba6e81ba787238e39c30fa8d67c786701955/ShellArgParser-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4a1d52c3374bc0354cd68e0fa286951f75af0d7db841324d10590877dc58ca91",
                "md5": "05876bc860fcf73e33796f69e31e077e",
                "sha256": "f1662031eb854e282ed558875971cf4e6c2d30289f7105b7c641148eca9c644e"
            },
            "downloads": -1,
            "filename": "shellargparser-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "05876bc860fcf73e33796f69e31e077e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15240,
            "upload_time": "2024-12-04T14:36:24",
            "upload_time_iso_8601": "2024-12-04T14:36:24.364138Z",
            "url": "https://files.pythonhosted.org/packages/4a/1d/52c3374bc0354cd68e0fa286951f75af0d7db841324d10590877dc58ca91/shellargparser-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-04 14:36:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thiswillbeyourgithub",
    "github_project": "ShellArgParser",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "shellargparser"
}
        
Elapsed time: 0.37017s