|
Boost Users : |
Subject: Re: [Boost-users] program_options: How to best model two/three pos args
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2014-10-08 04:46:34
On 10/08/2014 11:30 AM, Florian Lindner wrote:
> 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?
Frorian,
it appears that here, these positional options are not parsed, just passed through to
other code, so handling them as vector, like your third approach would, is easiest.
- Volodya
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