A POSIX-compliant CLI options parser for the Fish shell, offering a simpler alternative to argparse.
getopts.fish is a command-line options parser for the Fish shell. It parses CLI arguments according to POSIX guidelines, outputting key-value pairs that scripts can easily consume. It solves the problem of complex argument parsing in Fish by providing a simpler, more intuitive alternative to the built-in `argparse` command.
Fish shell users and developers writing scripts or command-line tools in Fish who need robust argument parsing without the complexity of `argparse`.
Developers choose getopts.fish for its adherence to POSIX standards, straightforward syntax, and elimination of implicit variables and companion commands, making argument parsing more transparent and easier to debug.
Parse CLI options in Fish
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Adheres to POSIX Utility Syntax Guidelines, ensuring consistent and standard parsing behavior across utilities, as demonstrated in the parsing rules for short and long options.
Eliminates the domain-specific language and implicit variables of argparse, making scripts easier to read and debug, as shown in the straightforward quickstart example with a switch statement.
Supports clustering of short options, non-alphabetic characters, and long options with key-value pairs, handling complex cases like -ab1 or --warp=10 from the README examples.
Outputs key-value records that can be easily read into variables using a while read loop, simplifying argument processing and reducing boilerplate code in Fish scripts.
Lacks built-in error reporting or validation; scripts must implement checks manually, as seen in the quickstart where invalid coordinates are handled with custom error messages.
Designed exclusively for the Fish shell, making it unsuitable for portable scripts or environments where cross-shell compatibility is required.
Requires installation via Fisher, adding an external dependency that may complicate setup in minimal or controlled systems compared to using built-in argparse.
Missing companion commands and advanced specs from argparse, such as automatic help generation or option descriptions, which are needed for more sophisticated CLI tools.