Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 3.37 KB

File metadata and controls

31 lines (25 loc) · 3.37 KB

Shell Argparser

DOI

The Argparser is designed to be an easy-to-use, yet powerful command-line argument parser for your shell scripts. It is mainly targeting Bash, but other shells are supported, as well. Shells other than Bash just require a slightly different method of invokation (i.e., running the Argparser in a pipe or process substitution, not by sourcing it).

Applying the Argparser should lead to shorter and more concise code than the traditionally used getopt/getopts or a bare suite of conditionals in a case..esac statement allow. More importantly, the user-friendliness of Argparser-powered command-line parsing is far superior thanks to a wide range of checked conditions with meaningful error messages.

The Argparser is entirely written in pure Bash, without invoking external commands. Thus, using it does not add additional dependencies to your script—except of course the Argparser itself—, especially not differing versions/implementations of a program (like with awk). Additionally, its design choices of not calling external commands and running almost without forking into subshells lead to a good runtime despite the extensive parsing and checking steps. The Argparser is inspired by the Python argparse module.

Table of contents 🡆