merge jkakar's working-directory branch

This commit is contained in:
Chris Jones 2009-01-27 22:44:44 +00:00
commit 78c04023fa
2 changed files with 12 additions and 0 deletions

View File

@ -52,6 +52,9 @@ Runs the specified command instead of your default shell or profile specified co
.TP .TP
.B \-x, \-\-execute=COMMAND [ARGS] .B \-x, \-\-execute=COMMAND [ARGS]
Runs \fBthe rest of the command line\fR instead of your default shell or profile specified command. Runs \fBthe rest of the command line\fR instead of your default shell or profile specified command.
.TP
.B \-\-working\-directory=DIR
Set the terminal's working directory
.SH "KEYBINDINGS" .SH "KEYBINDINGS"
The following keybindings can be used to control Terminator: The following keybindings can be used to control Terminator:
.TP .TP

View File

@ -101,6 +101,8 @@ if __name__ == '__main__':
parser.add_option ("-x", "--execute", dest="execute", action="callback", parser.add_option ("-x", "--execute", dest="execute", action="callback",
callback=execute_cb, help="Execute the remainder of the command line \ callback=execute_cb, help="Execute the remainder of the command line \
inside the terminal") inside the terminal")
parser.add_option ("--working-directory", metavar="DIR",
dest="working_directory", help="Set the terminal's working directory")
for item in ['--sm-client-id', '--sm-config-prefix', '--screen']: for item in ['--sm-client-id', '--sm-config-prefix', '--screen']:
parser.add_option (item, dest="dummy", action="store", help=SUPPRESS_HELP) parser.add_option (item, dest="dummy", action="store", help=SUPPRESS_HELP)
@ -130,6 +132,13 @@ does not make sense")
"Make sure DISPLAY is properly set")) "Make sure DISPLAY is properly set"))
sys.exit(1) sys.exit(1)
if options.working_directory:
if os.path.exists (os.path.expanduser (options.working_directory)):
os.chdir (os.path.expanduser (options.working_directory))
else:
err (_("The working directory you specified does not exist."))
sys.exit (1)
try: try:
open (os.path.expanduser ('~/.config/terminator/config')) open (os.path.expanduser ('~/.config/terminator/config'))
except IOError: except IOError: