Boost logo

Boost Users :

Subject: Re: [Boost-users] [EXTERNAL] Re: [Boost.Program_options] String options parser
From: Belcourt, Kenneth (kbelco_at_[hidden])
Date: 2017-06-14 00:03:28



> On Jun 13, 2017, at 4:23 PM, Michael Powell via Boost-users <boost-users_at_[hidden]> wrote:
>
> On Tue, Jun 13, 2017 at 5:09 PM, Belcourt, Kenneth via Boost-users
> <boost-users_at_[hidden]> wrote:
>> Hi,
>>
>> We have an executable that uses the program_options library to process
>> command line options like this:
>>
>> $ ./hilbert.x -h
>> -b [ --hilbert ] arg (=1) enable hilbert matrix
>> -e [ --epsilon ] arg (=0.001) roundoff epsilon
>> -h [ --help ] help message
>> -i [ --input-file ] arg process input file
>> -r [ --rank ] arg rank of matrix to construct
>> -t [ --tolerance ] arg (=1e-13) linear tolerance
>> -v [ --inverse ] arg (=0) enable inverse hilbert matrix
>> -w [ --wordsize ] arg (=8) floating-point word size (bytes)
>>
>> and it works great. Now we’re trying to automate some testing and we test
>> our executable with an input file that has hundreds of lines like this:
>>
>> --inverse 1 --tolerance 1e-15 --rank 2
>> --inverse 1 --tolerance 1e-15 --rank 3
>> --inverse 1 --tolerance 1e-15 --rank 4
>
> When I've used BPO with input sources, I've used "INI" file format,
> but I think it may also support other formats like Xml, Json, etc,
> (?), but I could be wrong about that. Along the lines of this:
>
> inverse=1
> tolerance=1e-15
> rank=2
>
> If you have several different point of entry, that may work, I'm not
> sure, or feed your subroutines several input sources, depending on how
> you've implemented your input handlers:
>
> inverse=1
> tolerance=1e-15
> rank=2
> inverse=1
> tolerance=1e-15
> rank=3
> inverse=1
> tolerance=1e-15
> rank=4

We’re hoping for a cleaner solution but we could certainly make this work. Thanks for the suggestion!


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