{"id":20694733,"url":"https://github.com/aneeshdurg/argparsh","last_synced_at":"2026-02-14T04:07:52.453Z","repository":{"id":261293373,"uuid":"883845905","full_name":"aneeshdurg/argparsh","owner":"aneeshdurg","description":"better argument parsing in the shell","archived":false,"fork":false,"pushed_at":"2025-03-05T13:38:31.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-27T16:20:07.422Z","etag":null,"topics":["argpa","bash","cli"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aneeshdurg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-05T17:12:34.000Z","updated_at":"2025-03-05T13:38:34.000Z","dependencies_parsed_at":"2025-04-22T19:59:24.461Z","dependency_job_id":"9a21443c-3935-4d1d-807d-e4994340d797","html_url":"https://github.com/aneeshdurg/argparsh","commit_stats":null,"previous_names":["aneeshdurg/argparsh"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aneeshdurg/argparsh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshdurg%2Fargparsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshdurg%2Fargparsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshdurg%2Fargparsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshdurg%2Fargparsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aneeshdurg","download_url":"https://codeload.github.com/aneeshdurg/argparsh/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aneeshdurg%2Fargparsh/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29435572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T03:34:37.767Z","status":"ssl_error","status_checked_at":"2026-02-14T03:34:09.092Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["argpa","bash","cli"],"created_at":"2024-11-17T00:06:12.844Z","updated_at":"2026-02-14T04:07:52.440Z","avatar_url":"https://github.com/aneeshdurg.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# argparsh\n\nEver wanted to parse arguments in bash but felt frustrated by giant case blocks\nand unfriendly syntax? Ever tried `getopts` but ended up curled on the floor\nsobbing? Have you ever spent sleepless nights hoping that bash argument parsing\ncould be as simple as python's\n[argparse](https://docs.python.org/3/library/argparse.html)? Maybe `argparsh` is\nfor you.\n\n`argparsh` aims to provide an easy way to construct an argument parsing program\nfrom any shell. Unlike most other shell CLI parsing utilities, `argparsh`\nsupports advanced features such as subcommands and even provides multiple output\nformats to allow maximum flexibility. `argparsh` uses python's `argparse` library\nfor parsing, providing a familiar and well-documented interface.\n\n## Usage\n\n```console\naneesh@earth:~/argparsh$ cat \u003e\u003e argparsh.sh\n# Create a parser that accepts a string and an optional int value\nparser=$({\n    # Initialize the parser with the name of the script and a description\n    argparsh new $0 -d \"Example parser\"\n\n    # Add a positional argument - note that args after -- are options to add_arg\n    # and not aliases for the argument\n    argparsh add_arg --helptext \"My string argument\" strarg\n\n    # Add a keyword argument that can either be -i \u003cvalue\u003e or --intarg \u003cvalue\u003e\n    argparsh add_arg \\\n        --helptext \"My int argument\" \\\n        --type int \\\n        --default 10 \\\n        -- -i --intarg\n})\n\n# Parse the input arguments with the parser above\neval $(argparsh parse $parser -- \"$@\")\n\n# Access parsed arguments by name\necho \"String argument was\" $strarg\necho \"Integer argument was\" $intarg\naneesh@earth:~/argparsh$ bash argparsh.sh -h\nusage: argparsh.sh [-h] [-i INTARG] strarg\n\nExample parser\n\npositional arguments:\n  strarg                My string argument\n\noptions:\n  -h, --help            show this help message and exit\n  -i INTARG, --intarg INTARG\n                        My int argument\naneesh@earth:~/argparsh$ bash argparsh.sh -i na Hello\nusage: argparsh.sh [-h] [-i INTARG] strarg\nargparsh.sh: error: argument -i/--intarg: invalid int value: 'na'\naneesh@earth:~/argparsh$ bash argparsh.sh -i 10 Hello\nString argument was Hello\nInteger argument was 10\n```\n\nSee `examples/example.sh` for a complete example, and examples of alternate\noutput formats (e.g. parsing CLI arguments into an associative array). The\n`examples` directory has a few other examples that show different ways to use\n`argparsh` in general.\n\nMore detailed help/documentation is available by running `argparsh \u003csubcommand\u003e --help`\n\n## Installation\n\n```sh\ncargo install argparsh\n```\n\nOr, to build from source:\n\n```sh\ngit clone https://github.com/aneeshdurg/argparsh.git\ncd argparsh\ncargo install --path .\n```\n\n## Similar Works\n\nargparsh differs from previous attempts at improving shell argument parsing by\nbeing shell agnostic (although only bash is tested, it is relatively easy to add\nsupport for more shells, contributions are welcome), supporting\nsubcommands/subparsers, and allowing detailed + customizable help text to be\nconfigured.\n\n+ [getopts](https://man7.org/linux/man-pages/man1/getopts.1p.html)\n    - the OG argument handling utility. A bit clunky to use.\n+ [argparse.sh](https://github.com/yaacov/argparse-sh)\n    - similar approach, but not completely shell agnostic, and lacking in more\n      advanced features, like subcommands.\n+ [fish argparse](https://fishshell.com/docs/current/cmds/argparse.html)\n    - Fish specific, but a nice utility. Not easy to use outside of fish and no\n      subcommand support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshdurg%2Fargparsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faneeshdurg%2Fargparsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faneeshdurg%2Fargparsh/lists"}