A minimal BASH wrapper for getopts that simplifies command-line argument parsing with one-line definitions.
Optparse is a simple command-line argument parser for BASH scripts that wraps the built-in getopts utility. It provides a clean, minimal interface for defining options, flags, and defaults, automatically generating usage descriptions to streamline script development.
BASH script developers and system administrators who need a straightforward way to handle command-line arguments without complex parsing logic.
Developers choose Optparse for its simplicity and minimalism—it reduces argument parsing to one-line definitions while staying lightweight and integrated with BASH's native getopts.
Simple command line arguments parser for BASH
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Each argument is defined with a single optparse.define call, drastically reducing code compared to manual getopts loops, as shown in the sample usage.
Builds and displays formatted usage descriptions based on argument definitions, making scripts user-friendly without extra coding.
Handles boolean flags by setting variables to true/false and allows default values for optional arguments, simplifying common scripting patterns.
Works by sourcing generated parsing logic within BASH scripts, ensuring compatibility with standard shell practices.
Requires gnu-sed on macOS instead of the default sed, adding an installation step and limiting portability, as highlighted in the README.
Missing advanced features like argument validation, subcommand support, or complex option interactions, which are common in more sophisticated CLI tools.
Requires sourcing an external file and proper installation via .bashrc, which can be cumbersome for quick or disposable scripts.