From 147db787d56a43e7bbf0641734f344b01cfeeea9 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 24 May 2012 00:53:20 +0100 Subject: [PATCH] Add completion to new-session and new-window commands Complete names of existing sessions and windows for the `new` commands, enabling easier creation of similarly named layouts. --- libexec/tmuxifier-new-session | 8 ++++++++ libexec/tmuxifier-new-window | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/libexec/tmuxifier-new-session b/libexec/tmuxifier-new-session index e0560eb..e8ce920 100755 --- a/libexec/tmuxifier-new-session +++ b/libexec/tmuxifier-new-session @@ -2,6 +2,14 @@ set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x +# Provide tmuxifier completions +if [ "$1" == "--complete" ]; then + for item in $(tmuxifier-list-sessions); do + echo "$item" + done + exit +fi + if [ -z "$1" ]; then echo "$(tmuxifier-help new-session)" >&2 exit 1 diff --git a/libexec/tmuxifier-new-window b/libexec/tmuxifier-new-window index 1c4919d..a405446 100755 --- a/libexec/tmuxifier-new-window +++ b/libexec/tmuxifier-new-window @@ -2,6 +2,14 @@ set -e [ -n "$TMUXIFIER_DEBUG" ] && set -x +# Provide tmuxifier completions +if [ "$1" == "--complete" ]; then + for item in $(tmuxifier-list-windows); do + echo "$item" + done + exit +fi + if [ -z "$1" ]; then echo "$(tmuxifier-help new-window)" >&2 exit 1