summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-18 04:23:44 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2017-08-30 00:13:03 +0000
commit1e44c649a40f0e3e555bcd8941a22381b92a9c1f (patch)
treea0c2fd8598cd6e8e5c286506227db01d2d21cf63
parenteb6c012f644f801d1e1524d80b09644976a17eda (diff)
downloadzsh-1e44c649a40f0e3e555bcd8941a22381b92a9c1f.tar.gz
zsh-1e44c649a40f0e3e555bcd8941a22381b92a9c1f.zip
41566: _tmux: Complete only attached sessions for detach-session.
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_tmux9
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 19846e790..968cc83fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2017-08-30 Daniel Shahaf <d.s@daniel.shahaf.name>
+ * 41566: Completion/Unix/Command/_tmux: Complete only attached
+ sessions for detach-session.
+
* 41564: Completion/Unix/Command/_tmux: Complete environment
variables and their values for set-environment and
show-environment.
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 7999be3eb..48fe29aee 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -302,7 +302,7 @@ _tmux-detach-client() {
_arguments -s \
'-a[kill all clients except for the named by -t]' \
'-P[send SIGHUP to parent process]' \
- '-s+[specify target session and kill its clients]:session:__tmux-sessions' \
+ '-s+[specify target session and kill its clients]:session:__tmux-sessions-attached' \
'-t+[specify target client]:client:__tmux-clients'
}
@@ -1366,6 +1366,13 @@ function __tmux-sessions() {
_describe -t sessions 'sessions' sessions "$@"
}
+function __tmux-sessions-attached() {
+ local -a sessions
+ sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
+ sessions=( ${(M)sessions:#*"(attached)"} )
+ _describe -t sessions 'attached sessions' sessions "$@"
+}
+
function __tmux-socket-name() {
local expl sdir
local curcontext="${curcontext}"