1 From 5a3e26fb4d2d3e90778d38e61854e193c9b26124 Mon Sep 17 00:00:00 2001
2 From: Dan Callaghan <dcallagh@redhat.com>
3 Date: Wed, 9 Jan 2013 19:40:22 +1000
4 Subject: [PATCH 1/4] new ParameterFence flag
6 This allows callers to define a parameter or option that causes every
7 subsequent argument to be parsed as a parameter, even if it looks like
10 This patch is based on the following phantomjs commit:
12 commit 23fe144a398239d25bf2a6624003274c3c3d6a50
13 Author: Ryan Cumming <etaoins@gmail.com>
14 Date: Fri Sep 14 08:04:06 2012 -0700
16 Treat all args after the script name as script args
18 This fixes CapserJS which builds a command line like this:
19 phantomjs bin/bootstrap.js --casper-path=~/capserjs --cli
21 That works on Phantom 1.6 but not on master due to the qcommandline
24 Fix by extending qcommandlne to take a ParameterFence flag which causes
25 it to treat any options after a parameter as arguments. Switch
26 "scriptname" to use that so the 1.6 behaviour is restored.
28 http://code.google.com/p/phantomjs/issues/detail?id=55
30 src/qcommandline.cpp | 3 +++
31 src/qcommandline.h | 1 +
32 2 files changed, 4 insertions(+)
34 diff --git a/src/qcommandline.cpp b/src/qcommandline.cpp
35 index bc28eff..c92a807 100644
36 --- a/src/qcommandline.cpp
37 +++ b/src/qcommandline.cpp
38 @@ -222,6 +222,9 @@ QCommandLine::parse()
39 entry.flags = (QCommandLine::Flags) (entry.flags | QCommandLine::Optional);
42 + if (entry.flags & QCommandLine::ParameterFence)
45 emit paramFound(entry.longName, arg);
47 if (!(entry.flags & QCommandLine::Multiple))
48 diff --git a/src/qcommandline.h b/src/qcommandline.h
49 index 6632d3c..2511127 100644
50 --- a/src/qcommandline.h
51 +++ b/src/qcommandline.h
52 @@ -85,6 +85,7 @@ public:
53 Multiple = 0x04, /**< argument can be used multiple time and will produce multiple signals. */
54 MandatoryMultiple = Mandatory|Multiple,
55 OptionalMultiple = Optional|Multiple,
56 + ParameterFence = 0x08, /**< all arguments after this point are considered parameters, not options. */