[prev in list] [next in list] [prev in thread] [next in thread]
List: konsole-devel
Subject: Re: Review Request 129677: Pre process the -e custom command argument
From: Wolfgang Bauer <wbauer () tmo ! at>
Date: 2016-12-20 9:41:59
Message-ID: 20161220094159.6043.26417 () mimi ! kde ! org
[Download RAW message or body]
--===============7270948271509158517==
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129677/#review101516
-----------------------------------------------------------
I can confirm that this patch works, it restores the correct handling of the '-e' \
option.
There is one problem though:
Running "konsole -e" (i.e. not specifying any command after '-e') will open a new \
konsole window instead of printing an error message about the missing command.
src/Application.cpp (lines 124 - 127)
<https://git.reviewboard.kde.org/r/129677/#comment67955>
I would suggest to only do this if there actually is an argument after '-e'.
This way, QCommandLineParser will see the '-e' option if no command is given and \
will print an error message because the argument is missing.
E.g. change the condition in the previous if to this:
if (i < 0 || args.size() <= i+1) {
return customCommand;
}
src/Application.cpp (lines 124 - 127)
<https://git.reviewboard.kde.org/r/129677/#comment67956>
- Wolfgang Bauer
On Dez. 19, 2016, 10:34 nachm., Maximiliano Curia wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/129677/
> -----------------------------------------------------------
>
> (Updated Dez. 19, 2016, 10:34 nachm.)
>
>
> Review request for Konsole, Kurt Hindenburg and Martin Tobias Holmedahl Sandsmark.
>
>
> Repository: konsole
>
>
> Description
> -------
>
> Special case parsing of -e, to avoid parsing parameters intended for the
> command to be executed.
>
>
> Diffs
> -----
>
> src/Application.h 8987d789b8b0789592c41ae1b0f4538f5229b64f
> src/Application.cpp 6256e08ccc9d57f052790550ca8f20ef3bac1716
> src/main.cpp 26d3da990b6aee564c0c9a237a56a65b1d372508
>
> Diff: https://git.reviewboard.kde.org/r/129677/diff/
>
>
> Testing
> -------
>
> It works for me.
>
>
> Thanks,
>
> Maximiliano Curia
>
>
--===============7270948271509158517==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 \
solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;"> \
<tr> <td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/129677/">https://git.reviewboard.kde.org/r/129677/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I can \
confirm that this patch works, it restores the correct handling of the '-e' \
option.</p> <p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">There is one problem though: Running "konsole -e" \
(i.e. not specifying any command after '-e') will open a new konsole window instead \
of printing an error message about the missing command.</p></pre> <br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/129677/diff/1/?file=487858#file487858line124" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/Application.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">124</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">args</span><span class="p">.</span><span class="n">removeAt</span><span \
class="p">(</span><span class="n">i</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">125</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">while</span> <span class="p">(</span><span class="n">args</span><span \
class="p">.</span><span class="n">size</span><span class="p">()</span> <span \
class="o">></span> <span class="n">i</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">126</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">customCommand</span> <span class="o"><<</span> <span \
class="n">args</span><span class="p">.</span><span class="n">takeAt</span><span \
class="p">(</span><span class="n">i</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">127</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="p">}</span></pre></td> </tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I \
would suggest to only do this if there actually is an argument after '-e'. This way, \
QCommandLineParser will see the '-e' option if no command is given and will print an \
error message because the argument is missing.</p> <p style="padding: \
0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">E.g. \
change the condition in the previous if to this: if (i < 0 || args.size() <= \
i+1) { return customCommand;
}</p></pre>
</div>
</div>
<br />
<div>
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; \
border-collapse: collapse; margin: 2px padding: 2px;"> <thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; \
font-size: 9pt; padding: 4px 8px; text-align: left;"> <a \
href="https://git.reviewboard.kde.org/r/129677/diff/1/?file=487858#file487858line124" \
style="color: black; font-weight: bold; text-decoration: \
underline;">src/Application.cpp</a> <span style="font-weight: normal;">
(Diff revision 1)
</span>
</th>
</tr>
</thead>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">124</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">args</span><span class="p">.</span><span class="n">removeAt</span><span \
class="p">(</span><span class="n">i</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">125</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="k">while</span> <span class="p">(</span><span class="n">args</span><span \
class="p">.</span><span class="n">size</span><span class="p">()</span> <span \
class="o">></span> <span class="n">i</span><span class="p">)</span> <span \
class="p">{</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">126</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="n">customCommand</span> <span class="o"><<</span> <span \
class="n">args</span><span class="p">.</span><span class="n">takeAt</span><span \
class="p">(</span><span class="n">i</span><span class="p">);</span></pre></td> </tr>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" \
align="right"><font size="2"></font></th> <td bgcolor="#c5ffc4" width="50%"><pre \
style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td> <th \
bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid \
#C0C0C0;" align="right"><font size="2">127</font></th> <td bgcolor="#c5ffc4" \
width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span \
class="p">}</span></pre></td> </tr>
</tbody>
</table>
<div style="margin-left: 2em;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"></pre> </div>
</div>
<br />
<p>- Wolfgang Bauer</p>
<br />
<p>On Dezember 19th, 2016, 10:34 nachm. CET, Maximiliano Curia wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: \
1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; \
-webkit-border-radius: 6px;"> <tr>
<td>
<div>Review request for Konsole, Kurt Hindenburg and Martin Tobias Holmedahl \
Sandsmark.</div> <div>By Maximiliano Curia.</div>
<p style="color: grey;"><i>Updated Dez. 19, 2016, 10:34 nachm.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
konsole
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" \
style="border: 1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">Special case parsing of -e, to avoid parsing parameters intended for the \
command to be executed.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: \
inherit;white-space: inherit;">It works for me.</p></pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>src/Application.h <span style="color: \
grey">(8987d789b8b0789592c41ae1b0f4538f5229b64f)</span></li>
<li>src/Application.cpp <span style="color: \
grey">(6256e08ccc9d57f052790550ca8f20ef3bac1716)</span></li>
<li>src/main.cpp <span style="color: \
grey">(26d3da990b6aee564c0c9a237a56a65b1d372508)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/129677/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--===============7270948271509158517==--
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic