Merge lp:~nfultz/terminator/terminator into lp:terminator/trunk

Proposed by Neal Fultz
Status: Merged
Merged at revision: 1446
Proposed branch: lp:~nfultz/terminator/terminator
Merge into: lp:terminator/trunk
Diff against target: 33 lines (+14/-2)
1 file modified
terminatorlib/optionparse.py (+14/-2)
To merge this branch: bzr merge lp:~nfultz/terminator/terminator
Reviewer Review Type Date Requested Status
Stephen Boddy Needs Fixing
Review via email: mp+163457@code.launchpad.net

Description of the change

This fixes https://bugs.launchpad.net/terminator/+bug/366644 by switching the -e and -x options when terminator is invoked as x-terminal-emulator.

This is my first bug fix on launchpad :)

To post a comment you must log in.
Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Hi Neal. First, thanks for the contribution. Unfortunately I won't apply this as is. My main issue is that you are changing the behaviour of -x too, by making it refuse arguments. The standard x terminal only has -e, so -x behaviour is not relevant to it. Gnome Terminal does not modify -x behaviour in the wrapper script available. So right now your patch adds more alternative behaviour. I'd be accepting of something that did what the Gnome Terminal wrapper script does (although obviously not in Perl ;-) Either a Python rewrite or integrated into the main terminator script.

Last (minor) point, we don't typically use camel case in the coding of Terminator, so is_X_terminal_emulator rather than isXTerminalEmulator.

review: Needs Fixing
lp:~nfultz/terminator/terminator updated
1417. By Neal Fultz <nfultz@neal-1015pe>

Bug 366644 / Don't modify -x when invoked as x-terminal-emulator

Revision history for this message
Neal Fultz (nfultz) wrote :

OK, pushed a fix; it's a little uglier, though. Just to be explicit,
there are four cases, one of them is supposed to fail:

./terminator -e man htop

terminator: error: Additional unexpected arguments found: ['htop']

./terminator -x man htop

works

./x-terminal-emulator -e man htop

works

./x-terminal-emulator -x man htop

works

On Sun, Aug 04, 2013 at 04:10:33PM -0000, Stephen Boddy wrote:
> Review: Needs Fixing
>
> Hi Neal. First, thanks for the contribution. Unfortunately I won't apply this as is. My main issue is that you are changing the behaviour of -x too, by making it refuse arguments. The standard x terminal only has -e, so -x behaviour is not relevant to it. Gnome Terminal does not modify -x behaviour in the wrapper script available. So right now your patch adds more alternative behaviour. I'd be accepting of something that did what the Gnome Terminal wrapper script does (although obviously not in Perl ;-) Either a Python rewrite or integrated into the main terminator script.
>
> Last (minor) point, we don't typically use camel case in the coding of Terminator, so is_X_terminal_emulator rather than isXTerminalEmulator.
>
>
> --
> https://code.launchpad.net/~nfultz/terminator/terminator/+merge/163457
> You are the owner of lp:~nfultz/terminator/terminator.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'terminatorlib/optionparse.py'
2--- terminatorlib/optionparse.py 2013-01-30 13:17:11 +0000
3+++ terminatorlib/optionparse.py 2013-08-04 19:43:25 +0000
4@@ -42,6 +42,8 @@
5 """Parse the command line options"""
6 usage = "usage: %prog [options]"
7
8+ is_X_terminal_emulator = os.path.basename(sys.argv[0]) == 'x-terminal-emulator'
9+
10 parser = OptionParser(usage)
11
12 parser.add_option('-v', '--version', action='store_true', dest='version',
13@@ -59,8 +61,18 @@
14 parser.add_option('--geometry', dest='geometry', type='string',
15 help=_('Set the preferred size and position of the window'
16 '(see X man page)'))
17- parser.add_option('-e', '--command', dest='command',
18- help=_('Specify a command to execute inside the terminal'))
19+
20+ if not is_X_terminal_emulator :
21+ parser.add_option('-e', '--command', dest='command',
22+ help=_('Specify a command to execute inside the terminal'))
23+ else :
24+ parser.add_option('--command', dest='command',
25+ help=_('Specify a command to execute inside the terminal'))
26+ parser.add_option('-e', '--execute2', dest='execute', action='callback',
27+ callback=execute_cb,
28+ help=_('Use the rest of the command line as a command to '
29+ 'execute inside the terminal, and its arguments'))
30+
31 parser.add_option('-g', '--config', dest='config',
32 help=_('Specify a config file'))
33 parser.add_option('-x', '--execute', dest='execute', action='callback',