myshellconfig/bash_completion.d/tmuxx

23 lines
652 B
Text
Raw Normal View History

#!/bin/bash
function _keys() {
KEYS=""
for KEY_DIR in ${TMUX_SESSION_DIRS[*]};do
#KEYS=${KEYS}" $(find ${KEY_DIR}/* -type f|awk -F ${KEY_DIR}/ '{print $2}'|sed 's/\.session$//')"
KEYS=$(find ${TMUX_SESSION_DIRS[*]} -type f -name "*.session" -exec basename {} \; 2>/dev/null |sed 's/\.session$//')
done
echo $KEYS
}
function _keyfiles() {
COMPREPLY=()
local CUR KEYS
CUR="${COMP_WORDS[COMP_CWORD]}"
#KEYS="$(find ${KEY_DIR}/* -type f|awk -F ${KEY_DIR}/ '{print $2}'|sed 's/\.session$//')"
KEYS=$(_keys)
COMPREPLY=( $(compgen -W "${KEYS}" -- ${CUR}) )
return 0
}
complete -F _keyfiles tmuxx