Dup Ver Goto 📝

CompletionScript

PT2/aw/lang/bash does not exist
To
19 lines, 46 words, 396 chars Page 'CompletionScript' does not exist.
#!/bin/bash
_tmx_completions()
{
  COMPREPLY=()
  local CURWORD="${COMP_WORDS[COMP_CWORD]}"
  local WORDS=()
  if tmux list-sessions >& /dev/null; then
    while read -r line
    do
      WORDS+=("$line")
    done < <(tmux list-sessions | cut -f1 -d:)
    COMPREPLY=($(compgen -W "${WORDS[*]}" -- "$CURWORD"))
  else
    echo "No tmux sessions"
  fi
}
complete -F _tmx_completions tmx