https://github.com/matejak/argbash Skip to content Sign up * Product + Features + Mobile + Actions + Codespaces + Packages + Security + Code review + Issues + Integrations + GitHub Sponsors + Customer stories * Team * Enterprise * Explore + Explore GitHub + Learn and contribute + Topics + Collections + Trending + Learning Lab + Open source guides + Connect with others + The ReadME Project + Events + Community forum + GitHub Education + GitHub Stars program * Marketplace * Pricing + Plans + Compare plans + Contact Sales + Education [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} matejak / argbash Public * * Notifications * Fork 52 * Star 1.1k Bash argument parsing code generator View license 1.1k stars 52 forks Star Notifications * Code * Issues 33 * Pull requests 5 * Actions * Security * Insights More * Code * Issues * Pull requests * Actions * Security * Insights This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 3 branches 29 tags Code Latest commit @matejak matejak Merge pull request #140 from KevCui/master ... fc20b08 Oct 2, 2020 Merge pull request #140 from KevCui/master Fix typos in README.md fc20b08 Git stats * 422 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github Make workflow work in pull requests Aug 2, 2020 bin The 2.10.0 release. Sep 22, 2020 doc The 2.10.0 release. Sep 22, 2020 docker Fix typo in docker/README.md Oct 2, 2020 resources The 2.10.0 release. Sep 22, 2020 src The 2.10.0 release. Sep 22, 2020 tests Added a functioning implementation of ARG_USE_PROGRAM. Sep 20, 2020 .codeclimate.yml Create .codeclimate.yml Aug 2, 2016 .gitignore Finalized API macro checks Jun 1, 2017 .travis.yml Added intelligent dash shebang substitution. Jun 29, 2018 AUTHORS Added attribution. Sep 19, 2020 ChangeLog The 2.10.0 release. Sep 22, 2020 LICENSE Clarified license of generated content. Mar 9, 2019 README.md Fix typos in README.md Oct 2, 2020 start_tmux.sh Fixed the broken env variables help message. May 11, 2019 View code argbash What it is Requirements README.md argbash Build Status Documentation Status argbash logo * Do you write Bash scripts that should accept arguments? * But they don't since arguments support is a daunting task, because ... * getopt is discouraged, getopts doesn't support long options, there is no widely-accepted Bash module to do the task and some solutions don't work on all platforms (Linux, OSX, MSW)... Give Argbash a try and stop being terrorized by those pesky arguments! With Argbash, you will get: * Fast, minimalistic declaration of arguments your script expects (see below for supported argument types). * Scripts generated from definitions once that can be used on all platforms that have bash. * Definitions embedded in few lines of the script itself (so you can use Argbash to regenerate the parsing part of your script easily). * Ability to re-use low-level Argbash-aware scripts by wrapping them by higher-level Argbash-aware ones conveniently, without duplicating code. * Easy installation (optional). Just grab a release, unzip it, go inside and run cd resources && make install (you may want to run sudo make install PREFIX=/usr for a system-wide installation). * Documentation and examples. Make your existing script powered by Argbash in a couple of minutes. Explore various Argbash flavours: Flavour Target group Argbash Use it if you want to try Argbash without installing it and online you have permanent access to the Internet. Argbash Install the package to have argbash ready locally all the CLI time. Argbash Pretty much like Argbash CLI, but you don't have to install Docker it, you just download the image. What it is Argbash is not a parsing library, but it is rather a code generator that generates a bash library tailor-made for your script. It lets you to describe arguments your script should take and then, you can generate the bash parsing code. It stays in your script by default, but you can have it generated to a separate file and let Argbash to include it in your script for you. In any case, you won't need Argbash to run the script. Argbash is very simple to use and the generated code is relatively nice to read. Moreover, argument definitions stay embedded in the script, so when you need to update the parsing logic, you just re-run the argbash script on the already generated script. So by writing few comments to your script and running the Argbash's bin/argbash over it, you will get a bash script with argument parsing. See the simple example source template and simple example script for the result. If you are not into long reading, let bin/ argbash-init generate the template for you. Following argument types are supported: * Positional arguments (defaults supported, possibility of fixed, variable or infinite number of arguments), * optional arguments that take one value, * boolean optional arguments, * repeated (i.e. non-overwriting) optional arguments, * incrementing (such as --verbose) optional arguments and * action optional arguments (such as --version, --help). Following outputs are available: * Bash scripts, tailor-made bash parsing libraries. * POSIX scripts that use getopts, also tailor-made. * Bash completion. * docopt-compliant usage message. * Manpage output using rst2man. The utility has been inspired by Python's argparse and the shflags project. Read the docs (latest stable version) for more info Requirements * bash that can work with arrays (most likely bash >= 3.0) (the only requirement for users - i.e. people that only execute scripts and don't make them) * autom4te utility that can work with sets (part of autoconf >= 2.63 suite) * basic utilities s.a. sed, grep, cat, test. About Bash argument parsing code generator Topics code-generator argument-parsing shell-scripts Resources Readme License View license Stars 1.1k stars Watchers 21 watching Forks 52 forks Releases 23 2.10.0 Latest Sep 22, 2020 + 22 releases Sponsor this project * ko_fi ko-fi.com/matejak Packages 1 Contributors 12 * * * * * * * * * * * * Languages * M4 56.6% * Shell 28.9% * Makefile 14.0% * Dockerfile 0.5% * (c) 2022 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.