From 6f7a595d2781a905ca63f958083968f94340c7da Mon Sep 17 00:00:00 2001 From: Jamu Kakar Date: Tue, 27 Jan 2009 11:16:00 -0800 Subject: [PATCH 1/2] - New --working-directory command-line option sets the terminal's initial working directory. --- terminator | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/terminator b/terminator index 2e9d0254..da7c2bf3 100755 --- a/terminator +++ b/terminator @@ -101,6 +101,8 @@ if __name__ == '__main__': parser.add_option ("-x", "--execute", dest="execute", action="callback", callback=execute_cb, help="Execute the remainder of the command line \ inside the terminal") + parser.add_option ("--working-directory", dest="working_directory", + help="Set the terminal's working directory") for item in ['--sm-client-id', '--sm-config-prefix', '--screen']: 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")) 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: open (os.path.expanduser ('~/.config/terminator/config')) except IOError: From 97700f2d7d10cb80ba1f39c9bf675f788627c9bb Mon Sep 17 00:00:00 2001 From: Jamu Kakar Date: Tue, 27 Jan 2009 11:19:01 -0800 Subject: [PATCH 2/2] - Added --working-directory to the manpage. - Added a metavar option to the --working-directory parser configuration, to make it's help text a touch prettier. --- doc/terminator.1 | 3 +++ terminator | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/terminator.1 b/doc/terminator.1 index 67f72e19..32e76d74 100644 --- a/doc/terminator.1 +++ b/doc/terminator.1 @@ -52,6 +52,9 @@ Runs the specified command instead of your default shell or profile specified co .TP .B \-x, \-\-execute=COMMAND [ARGS] 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" The following keybindings can be used to control Terminator: .TP diff --git a/terminator b/terminator index da7c2bf3..c6fe9542 100755 --- a/terminator +++ b/terminator @@ -101,8 +101,8 @@ if __name__ == '__main__': parser.add_option ("-x", "--execute", dest="execute", action="callback", callback=execute_cb, help="Execute the remainder of the command line \ inside the terminal") - parser.add_option ("--working-directory", dest="working_directory", - help="Set the terminal's working directory") + 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']: parser.add_option (item, dest="dummy", action="store", help=SUPPRESS_HELP)