I was looking on how to parse the command line arguments. I found this:
// A boolean option with multiple names (-f, --force)
QCommandLineOption forceOption(QStringList() << "f" << "force",
QCoreApplication::translate("main", "Overwrite existing files."));
parser.addOption(forceOption);
This works fine. But how can I add two values for a string value? For example, foo --source ...
should be the same with foo -s ...
.
I tried:
parser.addPositionalArgument(
QStringList() << "s" << "source",
QCoreApplication::translate("main", "...")
);
But this throws an error:
error: no matching function for call to
'QCommandLineParser::addPositionalArgument(QStringList&, QString)'
parser.addPositionalArgument(QStringList() << "t" << "title",
QCoreApplication::translate("main", "...."));
That's probably addPositionalArgument
expects a string instead of a string list.
But how can I alias two values?