Date: 2001-03-01 18:45:12
Most of us have written code to parse command lines. Recently, I got
tired of doing this over and over again and needed to parse some
complex switches for a small utility. I looked into getopt, which
you Unix folks are probably used to, but this wasn't very flexible
and stuck you with a Unix style of command line switches, which I
don't care for as a Windows programmer. getopt_long was a little
better in that it allowed for options of more than a single
character, and the GNU version even allowed the long options to be
specified with a single '-' instead of the "traditional" double '-'
which only Unix users would be used to, but it won't
accept "traditional" '/' switches known to DOS/Windows users.
Besides, it still restricted the ordering of the switches (the GNU
version allows you to interleave the options but it "rearranges" all
the arguments when you do this, so you lose any locality information
which is sometimes needed).
So... I set out and created a reusable parser that is configurable to
accept various "traditional" styles, both Unix and Windows/DOS with
several variants on both, and that allows you to interpret the
options/switches in accordance with it's locality on the command line.
This isn't your typical Boost library, but I was wondering if there
would be interest any way?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk