Boost logo

Boost Users :

Subject: Re: [Boost-users] Program_option: problems parsing multiple commands with multiple arguments
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2010-03-30 02:45:30


Luca Luisa wrote:

> Vladimir Prus wrote:
>> Luca Luisa wrote:
>>> Hello,
>>> this is my first post in Boost.
>>> If this post is not in the right mailing list please let me know, many
>>> thanks.
>>>
>>> I have problems using the "program_options" library while parsing a
>>> command line with multiple commands with multiple arguments each.
>>> The test.cpp is in attachment.
>>>
>>> I would like to pars such a command:
>>>
>>> ./test --firstCommand=arg1 arg2 arg3 --secondCommand=arg1 arg2 arg3
>>>
>>> and having as result:
>>> ************************
>>> First command detected
>>> List of parameters passed: arg1, arg2, arg3
>>>
>>> Second command detected
>>> List of parameters passed: arg1, arg2, arg3
>>> ************************
>>>
>>> But the first command bring the second command as part of its list of
>>> arguments with the result:
>>> ***********************
>>> First command detected
>>> List of parameters passed: arg1, arg2, arg3, --secondCommand=arg1,
>>> arg2, arg3,
>>> **********************
>>>
>>> Any hints would be appreciate.
>>
>> Is this problem present in 1.42? I believe at least one bugs with similar
>> symptoms was fixed there?
>>
>> - Volodya
>>
> I have the version 1.38.1 in Ubuntu.

I'm afraid you get to build SVN HEAD or 1.42, then. With SVN HEAD, your testcase produces this
output:

***List of commands detected:
Command[0]: firstCommand
Command[1]: secondCommand

First command detected
List of parameters passed: arg1, arg2, arg3,

Second command detected
List of parameters passed: arg1, arg2, arg3,

- 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