From 81cd5d8dd673eb0dbed78591c452a7c8d5c2a1f8 Mon Sep 17 00:00:00 2001 From: Dave Gray Date: Fri, 30 Mar 2018 15:19:51 -0700 Subject: [PATCH 1/2] allow specifying `current` as the session name to operate on a new window in the current session --- tmuxp/cli.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tmuxp/cli.py b/tmuxp/cli.py index d206c76a6e0..289bf1bee1c 100644 --- a/tmuxp/cli.py +++ b/tmuxp/cli.py @@ -321,11 +321,23 @@ def reattach(session): reattach(builder.session) return + session = None + if session_name == 'current': + sessions = t.list_sessions() or [] + for s in sessions: + if s.attached == '1' and (answer_yes or click.confirm( + 'Reuse session [%s]?' % s.name + )): + session = s + # need to create a new window, or the currently-active one will be clobbered + session.new_window() + break + try: click.echo( click.style('[Loading] ', fg='green') + click.style(config_file, fg='blue', bold=True)) - builder.build() + builder.build(session) if 'TMUX' in os.environ: # tmuxp ran from inside tmux if not detached and (answer_yes or click.confirm( From 29ab84d3c52b2ae8ec73ef24ce43933a44130985 Mon Sep 17 00:00:00 2001 From: Dave Gray Date: Mon, 2 Apr 2018 08:13:24 -0700 Subject: [PATCH 2/2] split long comment to two lines --- tmuxp/cli.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tmuxp/cli.py b/tmuxp/cli.py index 289bf1bee1c..d5ea6a969ec 100644 --- a/tmuxp/cli.py +++ b/tmuxp/cli.py @@ -329,7 +329,8 @@ def reattach(session): 'Reuse session [%s]?' % s.name )): session = s - # need to create a new window, or the currently-active one will be clobbered + # need to create a new window, + # or the currently-active one will be clobbered session.new_window() break