[Interest] QCommandLine parser: why can't value() return positional arguments?

Thiago Macieira thiago.macieira at intel.com
Sat Jan 31 02:30:25 CET 2015


On Friday 30 January 2015 16:59:45 Jason H wrote:
> This is my first use of the new class and I think it's missing a rather
> obvious feature.
> 
> If I parser.addPositionalArgument("key", ...) why can't I then return it
> with parser.value(key)?
> 
> When I try to use .value(key) I get:
> QCommandLineParser: option not defined: "key".
> It would be very desirable to be able to refer to it as "key" because that
> improves code readability, and if I take the time to specify a name in
> addPositionalArgument() why can't I use it?
> 
> Can someone correct me or is this something I should file as an improvement?

Because a "positional argument" has no name. It's everything that is left 
after the options are parsed. The "addPositionalArgument" function is just for 
the help output.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list