4 ms·
Speaking of CLI option/argument handling for shell scripts, I use getopts for simple scripts which have few switches and manual loop when I want to support long
by ducktective 4y ago
Speaking of CLI option/argument handling for shell scripts, I use getopts for simple scripts which have few switches and manual loop when I want to support long options.
1- short: http://mywiki.wooledge.org/BashFAQ/035#getopts http://mywiki.wooledge.org/BashFAQ/035#getopts
2- long: http://mywiki.wooledge.org/BashFAQ/035#Manual_loop http://mywiki.wooledge.org/BashFAQ/035#Manual_loop
I don't support `--option=` mode. I don't support giving options after arguments. I prepend info and errors with braces like : `[TAG] message` and print them to STDERR.
Opinions?