3 ms·
I like NetBSD sh's nextopt <https://github.com/NetBSD/src/blob/23fcbd850aae17ef0843523f36cb893b3a1e0ce8/bin/sh/options.c#L681 https://github.com/NetBSD/src/blob
by oguz-ismail 2y ago
I like NetBSD sh's nextopt <https://github.com/NetBSD/src/blob/23fcbd850aae17ef0843523f36cb893b3a1e0ce8/bin/sh/options.c#L681 https://github.com/NetBSD/src/blob/23fcbd850aae17ef0843523f3...>. Since getopt's internal state can't be reset portably, most shells roll their own option parser.
- cihangir 2y agoPlan 9’s ARG(2) [0] macros are worth a look too. No dependencies at all, just plain macros, super lightweight and easy to use. [0] https://9fans.github.io/plan9port/man/man3/arg.html https://9fans.github.io/plan9port/man/man3/arg.html