]> git.pld-linux.org Git - packages/qcommandline.git/blob - 0001-new-ParameterFence-flag.patch
- initial; from fc
[packages/qcommandline.git] / 0001-new-ParameterFence-flag.patch
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
5
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
8 an option.
9
10 This patch is based on the following phantomjs commit:
11
12 commit 23fe144a398239d25bf2a6624003274c3c3d6a50
13 Author: Ryan Cumming <etaoins@gmail.com>
14 Date:   Fri Sep 14 08:04:06 2012 -0700
15
16     Treat all args after the script name as script args
17
18     This fixes CapserJS which builds a command line like this:
19     phantomjs bin/bootstrap.js --casper-path=~/capserjs --cli
20
21     That works on Phantom 1.6 but not on master due to the qcommandline
22     port.
23
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.
27
28     http://code.google.com/p/phantomjs/issues/detail?id=55
29 ---
30  src/qcommandline.cpp | 3 +++
31  src/qcommandline.h   | 1 +
32  2 files changed, 4 insertions(+)
33
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);
40        }
41  
42 +      if (entry.flags & QCommandLine::ParameterFence)
43 +        allparam = true;
44 +
45        emit paramFound(entry.longName, arg);
46  
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. */
57      } Flags;
58  
59      /**
60 -- 
61 1.7.11.7
62
This page took 0.098562 seconds and 3 git commands to generate.