{"id":13602872,"url":"https://github.com/Anvil/bash-argsparse","last_synced_at":"2025-04-11T13:31:39.261Z","repository":{"id":4781094,"uuid":"5933166","full_name":"Anvil/bash-argsparse","owner":"Anvil","description":"An high level argument parsing library for bash","archived":false,"fork":false,"pushed_at":"2024-02-12T12:44:24.000Z","size":315,"stargazers_count":178,"open_issues_count":3,"forks_count":15,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-02T18:43:23.250Z","etag":null,"topics":["argparse","argsparse","argsparse-library","argument","bash","bash-completion","command","command-line-parser","completion","getopt","getopts","library","line","shell"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anvil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-24T10:47:51.000Z","updated_at":"2024-06-20T13:18:06.000Z","dependencies_parsed_at":"2022-07-09T15:35:04.187Z","dependency_job_id":null,"html_url":"https://github.com/Anvil/bash-argsparse","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anvil%2Fbash-argsparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anvil%2Fbash-argsparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anvil%2Fbash-argsparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anvil%2Fbash-argsparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anvil","download_url":"https://codeload.github.com/Anvil/bash-argsparse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223470297,"owners_count":17150528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["argparse","argsparse","argsparse-library","argument","bash","bash-completion","command","command-line-parser","completion","getopt","getopts","library","line","shell"],"created_at":"2024-08-01T18:01:41.178Z","updated_at":"2024-11-07T06:30:29.909Z","avatar_url":"https://github.com/Anvil.png","language":"Shell","readme":"bash-argsparse\n==============\n\nAn high level argument parsing library for bash.\n\nInspired, by the python argparse module, bash-argsparse purpose is to\nreplace the option-parsing and usage-describing functions commonly\nrewritten in all scripts.\n\nThis library is implemented for GNU bash version \u003e= 4.2. Prior\nversions of bash will fail at interpreting that code.\n\n\n### Online documentation\n\nDoxygen documentation is available online\n[here](http://argsparse.livna.org/doxygen/1.8/).\n\n\n### Tarballs\n\nThough Bash Argsparse is hosted at\n[github](https://github.com/Anvil/bash-argsparse), you can download\ntarballs at the following URL:\n[http://argsparse.livna.org/](http://argsparse.livna.org/)\n\n### RPMS\n\nThough you can build your own package using the provided spec file, a\nbash-argsparse package is currently available in fedora repositories,\nfor all releases from fedora 19 to rawhide. Ditto for RHEL/Centos 6 \u0026\n7, through the EPEL repository.\n\n### Features\n\nThe argsparse library offers to script developpers the following features:\n\n* Automatic help message generation\n* Simple option declarations\n* Different option types: simple, with value, with cumulative (uniq or\n  not) values\n* User-input checkings (either by type, enumerations or custom checking)\n* Hook settings\n* Option properties making them excluding each other, aliasing other\n  options, or (sic) non-optional.\n* Automatic bash completion generation.\n\n\n### Requirements, Bash settings\n\nA basic argsparse run requires no external commands except the\nquite-common \"getopt\" command. Some argsparse-built-in type checkings\nmay require some other (like \"host\" and \"getent\") but you do not have\nto use those types.\n\nArgsparse relies on a lot of bash built-in commands (\"printf\", \"[\",\n\"read\", ...) and internal features such as arrays, associative arrays,\nextended (ksh-like) globbing. That's why the \"extglob\" shell option is\nautomatically enabled and posix-mode is automatically disabled when\nloading the argsparse library.\n\nThe code has been tested on bash 4.1, 4.2 and 4.3 and is definitely\nnot POSIX-compliant.\n\nCompliance with the \"nounset\" and \"failglob\" bash settings is\nsupported.\n\nContent\n-------\n\n* argsparse.sh: the library.\n* tutorial: a bunch of small demonstration scripts for new users.\n* bash-argsparse.spec: a spec file to build RPM packages.\n* debian: the directory required to build deb packages.\n* Doxyfile: doxygen configuration file.\n* doxygen-bash.sed:\n  [bash-doxygen](https://github.com/Anvil/bash-doxygen) doxygen input\n  filter.\n* unittest: a test script to validate most of argsparse features.\n\n### Testing\n\nHere are the topics covered by scripts in tutorial directory:\n* 0-completion: An automatic bash completion demo for all other\n  tutorial scripts. This script will spawn a preconfigured interactive\n  bash.\n* 1-basics: Bash Argsparse basics\n* 2-values: Options accepting values\n* 3-cumulative-options: How to keep all user-given values\n* 4-types: Type-checking\n* 5-custom-types: User-defined types\n* 6-properties: Option properties\n* 7-value-checking: Advanced value checking using argsparse\n* 8-setting-hook: Changing the way options are set\n* 9-misc: Other misc argsparse features.\n\nInvoke each script without parameter or with --help to obtain usage message.\n\nKnown limitations (or bugs)\n---------------------------\n\n* You cannot have a short option without a long option.\n* Too few verifications about property values are made.\n* Compliance with errexit is not supported (yet).\n* Compliance with Non-bind versions of the \"host\" command has not been\n  tested.\n","funding_links":[],"categories":["bash"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnvil%2Fbash-argsparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnvil%2Fbash-argsparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnvil%2Fbash-argsparse/lists"}