C++ subcommand-like argument parsing -
i'm writing program in c++ expected behave svn, or systemctl, or other tools:
./a.out subcommand [option]... arguments-for-the-subcommand an example following:
./a.out remove --recursive directory1 directory2 the --recursive option valid remove subcommand.
i'm using boost.programoptions, , have had no luck in tries (the thing have right program accepts arguments gnu getopt way). although prefer wide-tested, there's no problem in switching library if portable , job properly.
thanks in advance, , sorry if question not explained.
best regards, kalrish.
p.s.: not sure if of help, i'm using gcc 4.7.2.
it should pretty simple boost program-options, can construct multiple option lists.
you create 1 each sub-command, , check argv[1] see subcommand , use correct option list.
Comments
Post a Comment