[Interest] QCommandLine parser: why can't value() return positional arguments?
jhihn at gmx.com
Sat Jan 31 20:55:45 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.
Couldn't it be more though? I don't see why if you do use addPositionalArgument, that it couldn't provide the mapping of name to position.
More information about the Interest