--helpfor free). This way you don't need to repeat yourself. Also, unix-opts doesn't depend on anything and allows to precisely control behavior of the parser via Common Lisp restarts.
GitHub repository: https://github.com/libre-man/unix-opts
You can install it via Quicklisp:
Here is an example how to define some command line options with unix-opts:
See it in action (full source code of the example):
$ sh example.sh --help example - program to demonstrate unix-opts library Available options: -h, --help print this help text -v, --verbose verbose output -l, --level LEVEL the program will run on LEVEL level -o, --output FILE redirect output to file FILE so that's how it works... free args: $ sh example.sh -v file1.txt file2.txt OK, running in verbose mode... free args: file1.txt, file2.txt $ sh example.sh --level 10 --output foo.txt bar.txt I see you've supplied level option, you want 10 level! I see you want to output the stuff to "foo.txt"! free args: bar.txt $ sh example.sh --level kitty foo.txt fatal: cannot parse "kitty" as argument of "--level" free args: $ sh example.sh --hoola-boola noola.txt warning: "--hoola-boola" option is unknown! free args: noola.txt $ sh example.sh -vgl=10 warning: "-g" option is unknown! OK, running in verbose mode... I see you've supplied level option, you want 10 level! free args:
It's distributed under MIT-license.