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

This commit is contained in:
Neal Fultz 2013-08-04 12:36:33 -07:00
parent 69f0e7c30e
commit c566e862f7
1 changed files with 14 additions and 7 deletions

View File

@ -42,10 +42,7 @@ def parse_options():
"""Parse the command line options""" """Parse the command line options"""
usage = "usage: %prog [options]" usage = "usage: %prog [options]"
isXTerminalEmulator = os.path.basename(sys.argv[0]) == 'x-terminal-emulator' is_X_terminal_emulator = os.path.basename(sys.argv[0]) == 'x-terminal-emulator'
dash_e = '-e'
dash_x = '-x'
if isXTerminalEmulator: (dash_e, dash_x) = (dash_x, dash_e)
parser = OptionParser(usage) parser = OptionParser(usage)
@ -64,11 +61,21 @@ def parse_options():
parser.add_option('--geometry', dest='geometry', type='string', parser.add_option('--geometry', dest='geometry', type='string',
help=_('Set the preferred size and position of the window' help=_('Set the preferred size and position of the window'
'(see X man page)')) '(see X man page)'))
parser.add_option(dash_e, '--command', dest='command',
help=_('Specify a command to execute inside the terminal')) if not is_X_terminal_emulator :
parser.add_option('-e', '--command', dest='command',
help=_('Specify a command to execute inside the terminal'))
else :
parser.add_option('--command', dest='command',
help=_('Specify a command to execute inside the terminal'))
parser.add_option('-e', '--execute2', dest='execute', action='callback',
callback=execute_cb,
help=_('Use the rest of the command line as a command to '
'execute inside the terminal, and its arguments'))
parser.add_option('-g', '--config', dest='config', parser.add_option('-g', '--config', dest='config',
help=_('Specify a config file')) help=_('Specify a config file'))
parser.add_option(dash_x, '--execute', dest='execute', action='callback', parser.add_option('-x', '--execute', dest='execute', action='callback',
callback=execute_cb, callback=execute_cb,
help=_('Use the rest of the command line as a command to execute ' help=_('Use the rest of the command line as a command to execute '
'inside the terminal, and its arguments')) 'inside the terminal, and its arguments'))