From 9e90a8adb7331c33c0db0c5316334899c50b46e9 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 25 Oct 2013 05:55:41 +0800 Subject: [PATCH] Fix -v bug for subparsers. Fix attach-session and kill-session bug if no server runnings --- tmuxp/cli.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tmuxp/cli.py b/tmuxp/cli.py index edbfd77dcc..27725fc6f6 100644 --- a/tmuxp/cli.py +++ b/tmuxp/cli.py @@ -245,6 +245,9 @@ def subcommand_attach_session(args): except IndexError as e: print('Session not found.') return + except Exception as e: + print(e.message[0]) + return if 'TMUX' in os.environ: del os.environ['TMUX'] @@ -260,7 +263,11 @@ def subcommand_kill_session(args): ctext = args.session_name[0] t = Server() - sessions = [s for s in t.sessions if s.get('session_name') == ctext] + try: + sessions = [s for s in t.sessions if s.get('session_name') == ctext] + except Exception as e: + print(e.message[0]) + return if (len(sessions) == 1): try: @@ -379,10 +386,7 @@ def main(): util.oh_my_zsh_auto_title() - print (args) - if args.version: - print('tmuxp %s' % __version__) - elif args.callback is subcommand_load: + if args.callback is subcommand_load: subcommand_load(args) elif args.callback is subcommand_convert: subcommand_convert(args)