{"id":19715675,"url":"https://github.com/mickaelblet/bash_args","last_synced_at":"2025-10-09T14:18:18.431Z","repository":{"id":254636631,"uuid":"777968940","full_name":"MickaelBlet/bash_args","owner":"MickaelBlet","description":"Parse and store arguments/options from argv natively on bash","archived":false,"fork":false,"pushed_at":"2025-01-06T02:18:20.000Z","size":244,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-06T03:22:05.501Z","etag":null,"topics":["argparse","argv","bash","bash-library","bash-only"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/MickaelBlet.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}},"created_at":"2024-03-26T20:48:11.000Z","updated_at":"2025-01-06T02:18:24.000Z","dependencies_parsed_at":"2024-08-27T06:28:59.525Z","dependency_job_id":"05430a2b-374f-4ede-aa3e-f1d91cccba93","html_url":"https://github.com/MickaelBlet/bash_args","commit_stats":null,"previous_names":["mickaelblet/bash_args"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MickaelBlet%2Fbash_args","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MickaelBlet%2Fbash_args/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MickaelBlet%2Fbash_args/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MickaelBlet%2Fbash_args/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MickaelBlet","download_url":"https://codeload.github.com/MickaelBlet/bash_args/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241036329,"owners_count":19898145,"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","argv","bash","bash-library","bash-only"],"created_at":"2024-11-11T22:39:07.527Z","updated_at":"2025-10-09T14:18:18.426Z","avatar_url":"https://github.com/MickaelBlet.png","language":"Shell","readme":"# Args\n\nParse and store arguments/options from `argv` natively on **bash**.  \nInspired by the Python library [argparse](https://python.readthedocs.io/en/latest/library/argparse.html).  \nCompatible with **bash** version \u003e= **4.2.0**.  \nDocumentations available at [documentations](#documentations).\n\n## Quikstart\n\n```bash\n#!/usr/bin/env bash\n\nset -euo pipefail\n\nsource \"args.sh\"\n\nargs_set_description \"example\" \"of\" \"description\"\nargs_set_epilog \"example of epilog\"\n\nargs_add_argument \\\n    --help \"take the first argument\" \\\n    --dest \"ARG1_VALUE\" \\\n    --required \\\n    -- \"ARG1\"\nargs_add_argument \\\n    --flag=\"-p\" --flag=\"--print-hello\" \\\n    --help=\"print hello\" \\\n    --action=\"store_true\" \\\n    --dest=\"DO_HELLO\"\nargs_add_argument \\\n    --help=\"help of option\" \\\n    --metavar=\"VALUE\" \\\n    --default=\"24\" \\\n    -- \"--option\"\n\nargs_parse_arguments \"$@\"\n\necho \"'ARG1' argument from dest ${ARG1_VALUE:-}\"\necho \"'ARG1' argument from map  ${ARGS[ARG1]}\"\necho \"'--option' option from map ${ARGS[option]}\"\nif ${DO_HELLO:-false}; then\n    echo \"Hello world\"\nfi\n```\n\n```\n$ ./example/quickstart.sh\nusage: quickstart.sh [-h] [-p] [--option VALUE] -- ARG1\nquickstart.sh: argument 'ARG1' is required\n$ ./example/quickstart.sh -h\nusage: quickstart.sh [-h] [-p] [--option VALUE] -- ARG1\n\nexample of description\n\npositional arguments:\n  ARG1                  take the first argument\n\noptional arguments:\n  -h, --help            print this help message\n  -p, --print-hello     print hello\n  --option VALUE        help of option\n\nexample of epilog\n$ ./example/quickstart.sh 42\n'ARG1' argument from dest 42\n'ARG1' argument from map  42\n'--option' option from map 24\n$ ./example/quickstart.sh 42 -p\n'ARG1' argument from dest 42\n'ARG1' argument from map  42\n'--option' option from map 24\nHello world\n$ ./example/quickstart.sh 42 -p --option 42\n'ARG1' argument from dest 42\n'ARG1' argument from map  42\n'--option' option from map 42\nHello world\n```\n\n## Documentations\n\n### Functions\n\n|Function|Description|\n|--:|---|\n|[args_add_argument](docs/functions.md#args_add_argument)|Add a argument.|\n|[args_parse_arguments](docs/functions.md#args_parse_arguments)|Convert argument strings to objects and assign them as attributes on the ARGS map.|\n|[args_clean](docs/functions.md#args_clean)|Clean all map and array for recalled.|\n|[args_count](docs/functions.md#args_count)|Count the number of occurence of argument after parsed.|\n|[args_debug_values](docs/functions.md#args_debug_values)|Show all values of arguments and options.|\n|[args_isexists](docs/functions.md#args_isexists)|Check if argument is exists after parsed.|\n|[args_set_alternative](docs/functions.md#args_set_alternative)|Set if args_parse_arguments can be accept a single '-' for a long option.|\n|[args_set_description](docs/functions.md#args_set_description)|Set a usage description.|\n|[args_set_epilog](docs/functions.md#args_set_epilog)|Set a epilog description.|\n|[args_set_program_name](docs/functions.md#args_set_program_name)|Set the program name for usage message.|\n|[args_set_usage_widths](docs/functions.md#args_set_usage_widths)|Set the widths of usage message.|\n|[args_set_usage](docs/functions.md#args_set_usage)|Set a full usage message.|\n|[args_usage](docs/functions.md#args_usage)|Show/Generate usage message.|\n\n### Global variables\n\n|Name|Description|\n|--:|---|\n|__ARGS|Assossiative array for use internaly in args script.|\n|ARGS|Assossiative array for store after [args_parse_arguments](../README.md#args_parse_arguments).|","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickaelblet%2Fbash_args","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmickaelblet%2Fbash_args","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmickaelblet%2Fbash_args/lists"}