]> git.corax.cc Git - toolbox/commit
include/opt: Use an associative array to simplify flag parsing
authorMatthias Kruk <m@m10k.eu>
Thu, 11 Aug 2022 16:54:00 +0000 (01:54 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 11 Aug 2022 16:54:00 +0000 (01:54 +0900)
commitc5e2758931d222fb20b552fb2a0d71fe83e8bbc9
treed15d345bbe7e717598144a36999fa7c25a598872
parent01d6c530a02bce5289830d62b32026af3d3554f3
include/opt: Use an associative array to simplify flag parsing

When parsing the flags of an option, the opt module uses a case
construct, which looks clumsy, isn't very easy to read, and makes
adding new flags more complicated than need be.

This commit modifies the opt module to use an associative array
to simplify flag parsing. This way, the parser only has to use a
flag as index into the array in order to find out its internal
value.
include/opt.sh