Skip to content

Commit ea388ab

Browse files
committed
Support for spaces in cli attach-session, kill-session and freeze. Bump to v0.0.35
1 parent 2d312a8 commit ea388ab

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

CHANGES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ Here you can find the recent changes to tmuxp.
88

99
- [docs] Many documentation, pep247, pep8 fixes
1010
- [cli] #12 bug fix for ``$ tmuxp freeze`` by @finder.
11+
- [internal] move old :class:`Server` methods ``__list_panes()``,
12+
``__list_windows`` and ``__list_sessions`` into the single underscore.
13+
- [cli] Support for spaces in ``$ tmuxp attach-session`` and
14+
``$ tmuxp kill-session``, and `` $ tmuxp freeze``.
1115

1216
2013-11-01
1317
----------

tmuxp/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323

2424
import logging
2525

26-
__version__ = '0.0.34'
26+
__version__ = '0.0.35'

tmuxp/cli.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,14 +302,16 @@ def get_server_from_args(args):
302302
def command_freeze(args):
303303
""" Import teamocil config to tmuxp format. """
304304

305+
ctext = ' '.join(args.session_name)
306+
305307
t = Server(
306308
socket_name=args.socket_name,
307309
socket_path=args.socket_path,
308310
colors=args.colors
309311
)
310312

311313
session = t.findWhere({
312-
'session_name': args.session_name
314+
'session_name': ctext
313315
})
314316

315317
sconf = freeze(session)
@@ -627,20 +629,21 @@ def command_convert(args):
627629
def command_attach_session(args):
628630
""" Command to attach / switch client to a tmux session."""
629631
commands = []
630-
ctext = args.session_name
632+
ctext = ' '.join(args.session_name)
631633

632634
t = Server(
633635
socket_name=args.socket_name,
634636
socket_path=args.socket_path,
635637
colors=args.colors
636638
)
639+
637640
try:
638641
session = next((s for s in t.sessions if s.get(
639642
'session_name') == ctext), None)
640643
if not session:
641644
raise Exception('Session not found.')
642645
except Exception as e:
643-
print(e.message[0])
646+
print(e.message)
644647
return
645648

646649
if 'TMUX' in os.environ:
@@ -655,7 +658,7 @@ def command_attach_session(args):
655658
def command_kill_session(args):
656659
""" Command to kill a tmux session."""
657660
commands = []
658-
ctext = args.session_name
661+
ctext = ' '.join(args.session_name)
659662

660663
t = Server(
661664
socket_name=args.socket_name or None,
@@ -668,11 +671,12 @@ def command_kill_session(args):
668671
if not session:
669672
raise Exception('Session not found.')
670673
except Exception as e:
671-
print(e.message[0])
674+
print(e.message)
672675
return
673676

674677
try:
675678
session.kill_session()
679+
print("Killed session %s." % ctext)
676680
except Exception as e:
677681
logger.error(e)
678682

@@ -696,15 +700,19 @@ def get_parser():
696700
kill_session.add_argument(
697701
dest='session_name',
698702
type=str,
703+
nargs='+',
699704
default=None,
705+
help='Name of session',
700706
).completer = SessionCompleter
701707

702708
attach_session = subparsers.add_parser('attach-session')
703709
attach_session.set_defaults(callback=command_attach_session)
704710

705711
attach_session.add_argument(
706712
dest='session_name',
713+
nargs='+',
707714
type=str,
715+
help='Name of session',
708716
).completer = SessionCompleter
709717

710718
freeze = subparsers.add_parser('freeze')
@@ -713,6 +721,8 @@ def get_parser():
713721
freeze.add_argument(
714722
dest='session_name',
715723
type=str,
724+
nargs='+',
725+
help='Name of session',
716726
).completer = SessionCompleter
717727

718728
load = subparsers.add_parser('load')

0 commit comments

Comments
 (0)