diff options
Diffstat (limited to 'completions/screen')
-rw-r--r-- | completions/screen | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/completions/screen b/completions/screen index 6b5c319f..3b9fb272 100644 --- a/completions/screen +++ b/completions/screen @@ -2,22 +2,22 @@ _screen_sessions() { - local sessions=( $( command screen -ls | command sed -ne \ - 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p' ) ) + local sessions=( $(command screen -ls | command sed -ne \ + 's|^\t\{1,\}\([0-9]\{1,\}\.[^\t]\{1,\}\).*'"$1"'.*$|\1|p') ) if [[ $cur == +([0-9])?(.*) ]]; then # Complete sessions including pid prefixes - COMPREPLY=( $( compgen -W '${sessions[@]}' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '${sessions[@]}' -- "$cur") ) else # Create unique completions, dropping pids where possible local -A res local i tmp - for i in ${sessions[@]}; do + for i in "${sessions[@]}"; do res[${i/#+([0-9])./}]+=" $i" done - for i in ${!res[@]}; do + for i in "${!res[@]}"; do [[ ${res[$i]} == \ *\ * ]] && tmp+=" ${res[$i]}" || tmp+=" $i" done - COMPREPLY=( $( compgen -W '$tmp' -- "$cur" ) ) + COMPREPLY=( $(compgen -W '$tmp' -- "$cur") ) fi } && _screen() @@ -27,7 +27,7 @@ _screen() if ((cword > 2)); then case ${words[cword-2]} in - -[dD]) + -*[dD]) _screen_sessions return ;; @@ -37,7 +37,7 @@ _screen() local i for (( i=1; i <= cword; i++ )); do case ${words[i]} in - -r|-R|-d|-D|-x|-s|-c|-T|-e|-h|-p|-S|-t) + -*[rRdDxscTehpSt]) (( i++ )) continue ;; @@ -51,26 +51,26 @@ _screen() done case $prev in - -[rR]) + -*[rR]) # list detached _screen_sessions 'Detached' return ;; - -[dD]) + -*[dD]) # list attached _screen_sessions 'Attached' return ;; - -x) + -*x) # list both _screen_sessions return ;; - -s) + -*s) _shells return ;; - -c) + -*c) _filedir return ;; @@ -78,15 +78,15 @@ _screen() _terms return ;; - -e|-h|-p|-S|-t) + -*[ehpSt]) return ;; esac if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln -list + COMPREPLY=( $(compgen -W '-a -A -c -d -D -e -f -fn -fa -h -i -ln -list -L -m -O -p -q -r -R -s -S -t -T -U -v -wipe -x -X --help - --version' -- "$cur" ) ) + --version' -- "$cur") ) fi } && complete -F _screen screen |