Boost logo

Boost Users :

Subject: [Boost-users] program_options: How to best model two/three pos args
From: Florian Lindner (mailinglists_at_[hidden])
Date: 2014-10-08 03:30:21


Hello,

my application has positional arguments like that:

Run tests : ./app test ConfigurationName PathToSrc
Run server : ./app server ParticipantName ConfigurationName
Print XML reference: ./app xml Linewidth

It has three (if first in [test, server]) or two (if first in [xml])
positional arguments.

How to model and test this best using boost?

I could add three options and declare them as positional arguments, named
like "first", "second", "third".

I could also use just one positional argument like:

po::positional_options_description pos_dec;
pos_dec.add("positionals", 3);

and test the resulting vector.

What do you think?

Thanks,
Florian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net