{"id":13660450,"url":"https://github.com/hanovruslan/bash-get-options","last_synced_at":"2025-04-24T19:30:59.576Z","repository":{"id":77383511,"uuid":"100559368","full_name":"hanovruslan/bash-get-options","owner":"hanovruslan","description":"get options from script args","archived":false,"fork":false,"pushed_at":"2018-04-12T07:24:05.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-10T14:42:26.754Z","etag":null,"topics":["bash"],"latest_commit_sha":null,"homepage":null,"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/hanovruslan.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}},"created_at":"2017-08-17T03:55:16.000Z","updated_at":"2019-04-03T21:45:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"cbd24388-fb80-4e94-9836-14126642945f","html_url":"https://github.com/hanovruslan/bash-get-options","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanovruslan%2Fbash-get-options","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanovruslan%2Fbash-get-options/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanovruslan%2Fbash-get-options/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hanovruslan%2Fbash-get-options/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hanovruslan","download_url":"https://codeload.github.com/hanovruslan/bash-get-options/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250693506,"owners_count":21472270,"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":["bash"],"created_at":"2024-08-02T05:01:21.706Z","updated_at":"2025-04-24T19:30:59.256Z","avatar_url":"https://github.com/hanovruslan.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# bash-get-options #\n\nget options from script args\n\ntry\n\n- `./main.sh`\n- `./main.sh -x foo`\n- `./main.sh -y bar`\n- `./main.sh -x bar -y foo`\n- `./main.sh -y bar -x foo`\n- `./main.sh -x bar -x foo`\n\n## How to include into your script/project ##\n\n1. `git clone` this repo\n1. include line `source /path/to/this/repo/src/src.sh`\n1. set up your args dict and defaults\n\n        declare -A options_dict=(\n            [x]=xvar\n            [y]=yvar\n        )\n        declare -A options_defaults=(\n            [xvar]=\"xvalue\"\n            [yvar]=\"y1 y2 y3\"\n        )\n1. add args processing snippet and export vars into current process\n\n        bgo_main ${@}\n\n1. now you can use it as array values\n\n        echo \"xvar = ${xvar[@]}\"\n        echo \"yvar = ${yvar[@]}\"\n        for y in ${yvar[@]}\n        do\n            echo ${y}\n        done\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanovruslan%2Fbash-get-options","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhanovruslan%2Fbash-get-options","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhanovruslan%2Fbash-get-options/lists"}