Hacker News new | ask | show | jobs
by barrkel 3435 days ago
There are really only edge cases in usage models - I've found option libraries all fairly poor, because they expose a global view of the options, rather than an iterator view, for the most part.

If args are in a structure that can be peeked and shifted, you're in a good place for context sensitive options. It's just a lexer.

My tools tend towards this syntax:

    cmd [<global opt>...] subcommand [<local opt>...]
Composing the data structure for this with option libraries is often more work than iterating over a peekable stream of words.