summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineparser.h
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2015-02-06 11:18:55 +0100
committerDavid Faure <david.faure@kdab.com>2015-03-06 09:09:31 +0000
commit74117b51009b9b2a15714597f5953b0ffc8824b9 (patch)
tree1939a4f98830f3e4787c960e4ba0a40c7ad3cd42 /src/corelib/tools/qcommandlineparser.h
parentaabbb87f4a2b0b013d0abc7efc65f2b85f64aa8f (diff)
QCommandLineParser: add parsing mode for options after arguments
The new mode, ParseAsPositionalArguments, allows to interpret "application argument --opt" as having two positional arguments, "argument" and "--opt". This mode is useful for executables that aim to launch other executables (e.g. wrappers, debugging tools, etc.) or who support internal commands followed by options for the command. "argument" is the name of the command, and all options occurring after it can be collected and parsed by another command line parser, possibly in another executable. [ChangeLog][QtCore][QCommandLineParser] Add parsing mode for options after arguments, to allow treating them as more arguments. Change-Id: I48d5fcf90f2f59deda8422538b8ebf2680fae828 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qcommandlineparser.h')
-rw-r--r--src/corelib/tools/qcommandlineparser.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qcommandlineparser.h b/src/corelib/tools/qcommandlineparser.h
index 91a799b4d5..8c528ba69e 100644
--- a/src/corelib/tools/qcommandlineparser.h
+++ b/src/corelib/tools/qcommandlineparser.h
@@ -57,6 +57,12 @@ public:
};
void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode);
+ enum OptionsAfterPositionalArgumentsMode {
+ ParseAsOptions,
+ ParseAsPositionalArguments
+ };
+ void setOptionsAfterPositionalArgumentsMode(OptionsAfterPositionalArgumentsMode mode);
+
bool addOption(const QCommandLineOption &commandLineOption);
bool addOptions(const QList<QCommandLineOption> &options);