@@ -302,14 +302,16 @@ def get_server_from_args(args):
302
302
def command_freeze (args ):
303
303
""" Import teamocil config to tmuxp format. """
304
304
305
+ ctext = ' ' .join (args .session_name )
306
+
305
307
t = Server (
306
308
socket_name = args .socket_name ,
307
309
socket_path = args .socket_path ,
308
310
colors = args .colors
309
311
)
310
312
311
313
session = t .findWhere ({
312
- 'session_name' : args . session_name
314
+ 'session_name' : ctext
313
315
})
314
316
315
317
sconf = freeze (session )
@@ -627,20 +629,21 @@ def command_convert(args):
627
629
def command_attach_session (args ):
628
630
""" Command to attach / switch client to a tmux session."""
629
631
commands = []
630
- ctext = args .session_name
632
+ ctext = ' ' . join ( args .session_name )
631
633
632
634
t = Server (
633
635
socket_name = args .socket_name ,
634
636
socket_path = args .socket_path ,
635
637
colors = args .colors
636
638
)
639
+
637
640
try :
638
641
session = next ((s for s in t .sessions if s .get (
639
642
'session_name' ) == ctext ), None )
640
643
if not session :
641
644
raise Exception ('Session not found.' )
642
645
except Exception as e :
643
- print (e .message [ 0 ] )
646
+ print (e .message )
644
647
return
645
648
646
649
if 'TMUX' in os .environ :
@@ -655,7 +658,7 @@ def command_attach_session(args):
655
658
def command_kill_session (args ):
656
659
""" Command to kill a tmux session."""
657
660
commands = []
658
- ctext = args .session_name
661
+ ctext = ' ' . join ( args .session_name )
659
662
660
663
t = Server (
661
664
socket_name = args .socket_name or None ,
@@ -668,11 +671,12 @@ def command_kill_session(args):
668
671
if not session :
669
672
raise Exception ('Session not found.' )
670
673
except Exception as e :
671
- print (e .message [ 0 ] )
674
+ print (e .message )
672
675
return
673
676
674
677
try :
675
678
session .kill_session ()
679
+ print ("Killed session %s." % ctext )
676
680
except Exception as e :
677
681
logger .error (e )
678
682
@@ -696,15 +700,19 @@ def get_parser():
696
700
kill_session .add_argument (
697
701
dest = 'session_name' ,
698
702
type = str ,
703
+ nargs = '+' ,
699
704
default = None ,
705
+ help = 'Name of session' ,
700
706
).completer = SessionCompleter
701
707
702
708
attach_session = subparsers .add_parser ('attach-session' )
703
709
attach_session .set_defaults (callback = command_attach_session )
704
710
705
711
attach_session .add_argument (
706
712
dest = 'session_name' ,
713
+ nargs = '+' ,
707
714
type = str ,
715
+ help = 'Name of session' ,
708
716
).completer = SessionCompleter
709
717
710
718
freeze = subparsers .add_parser ('freeze' )
@@ -713,6 +721,8 @@ def get_parser():
713
721
freeze .add_argument (
714
722
dest = 'session_name' ,
715
723
type = str ,
724
+ nargs = '+' ,
725
+ help = 'Name of session' ,
716
726
).completer = SessionCompleter
717
727
718
728
load = subparsers .add_parser ('load' )
0 commit comments