News for hackers. Stuff that matters.
Re:Argbash: Bash argument parsing code generator by mbrock on Tuesday March 22, 2022 @11:03AM (#30766916)
If you're okay with depending on Git, you can use `git rev-parse --parseopt`.

https://git-scm.com/docs/git-rev-parse#_parseopt

> In --parseopt mode, git rev-parse helps massaging options to bring to shell scripts the same facilities C builtins have. It works as an option normalizer (e.g. splits single switches aggregate values), a bit like getopt(1) does.

> It takes on the standard input the specification of the options to parse and understand, and echoes on the standard output a string suitable for sh(1) eval to replace the arguments with normalized ones. In case of error, it outputs usage on the standard error stream, and exits with code 129.

Re:Argbash: Bash argument parsing code generator by unixhero on Tuesday March 22, 2022 @05:17PM (#30771693)
This is really brilliant and I have never heard of this method before. Noting it down thank you.