3 ms·
Just to expand on this: options can be position-dependent, and treat options as an algebra (a --and b --or c); or, just executed in order to eg change directory
by hyperpallium 11y ago
Just to expand on this: options can be position-dependent, and treat options as an algebra (a --and b --or c); or, just executed in order to eg change directory (-d dir1 a b c -d dir2 x y z).
Basically, by treating the arguments as a stream of tokens, it can be parsed with the same power used for parsing the source of programming language.
Yet for many uses there are natural complexity-levels for option parser tools (like position-independent boolean options, and options taking one argument), hence the many tools for many niches.
And they are easy to write, so everyone writes one.