Boost logo

Boost Users :

Subject: [Boost-users] subcommands with program_options (like svn command)
From: Adrien Guillon (aj.guillon_at_[hidden])
Date: 2010-07-27 15:02:19

Hello all,

I am writing a moderately complex command-line application, and I have
been looking at program_options for simplifying my life. The best way
to describe what I want to do, is in term of the svn command (which I
assume most people are familiar with). In particular, what I want to
do is expose a number of subcommands for controlling the application,
each of which has their own particular options.

For example, if I were to write svn using program_options, then the
first command I have to accept could be one of: add, checkout, del,
log, etc. Each of these commands has a separate list of arguments
that they accept themselves. I'm a bit stumped on how exactly to do
this with program_options, because the first argument (which I can do
using positional arguments) decides what other arguments are valid.

Any thoughts or suggestions?



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at