From cd2d50c32e5e17a7f141bf08bc70f61d64a45e48 Mon Sep 17 00:00:00 2001 From: Jeff Fisher Date: Fri, 16 Mar 2012 22:01:22 -0600 Subject: [PATCH 1/2] document the ability to pass ssh options. --- crussh.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crussh.py b/crussh.py index 2f2f80b..bbbe6d9 100755 --- a/crussh.py +++ b/crussh.py @@ -277,12 +277,15 @@ if __name__ == "__main__": import argparse ### Parse CLI Args ### - parser = argparse.ArgumentParser(description="Connect to multiple servers in parallel.", usage="%(prog)s [OPTIONS] HOST [HOST ...]") + parser = argparse.ArgumentParser( + description="Connect to multiple servers in parallel.", + usage="%(prog)s [OPTIONS] [--] HOST [HOST ...]", + epilog="* NOTE: You can pass options to ssh if you add '--' before your list of hosts") (args, hosts) = parser.parse_known_args() if len(hosts) == 0: parser.print_usage() - sys.exit(1) + parser.exit(2) if "--" in hosts: offset = hosts.index("--") + 1 From d37362aadf2f2f8e300803eaa75982fcc6510fee Mon Sep 17 00:00:00 2001 From: Jeff Fisher Date: Fri, 16 Mar 2012 22:10:18 -0600 Subject: [PATCH 2/2] 'is not None' is more pythonic. extra indention on some of the icon code. --- crussh.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crussh.py b/crussh.py index bbbe6d9..9749542 100755 --- a/crussh.py +++ b/crussh.py @@ -31,7 +31,7 @@ class CruSSHConf: ### Signal Hooks ### def save_hook(self, discard, save_func): self.MainWin.destroy() - if save_func != None: + if save_func is not None: save_func(self.Config) def font_hook(self, fontbutton): @@ -87,7 +87,7 @@ class CruSSHConf: # we'll wire up a supplied save_func that takes the Config dict as an argument. def __init__(self, config=None, save_func=None): - if config != None: + if config is not None: self.Config = config self.initGUI(save_func) @@ -169,9 +169,9 @@ class CruSSH: theme = gtk.icon_theme_get_default() icon_list = [] if theme.has_icon("terminal"): - icon = theme.lookup_icon("terminal", 128, flags=gtk.ICON_LOOKUP_USE_BUILTIN) - if icon != None: - gtk.window_set_default_icon(icon.load_icon()) + icon = theme.lookup_icon("terminal", 128, flags=gtk.ICON_LOOKUP_USE_BUILTIN) + if icon is not None: + gtk.window_set_default_icon(icon.load_icon()) self.MainWin.set_title("crussh: " + ' '.join(self.Terminals.keys())) self.MainWin.set_role(role="crussh_main_win") self.MainWin.connect("delete-event", lambda window, event: gtk.main_quit())