diff options
author | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
---|---|---|
committer | David Paleino <dapal@debian.org> | 2011-11-03 12:32:52 +0100 |
commit | 2c8171c38d87ddef31c92a76547d3fdf773a1337 (patch) | |
tree | 5e720d5a06ead72ed55454bf6647a712a761ed91 /completions/vncviewer | |
parent | 9920a8faedf704420571d8072ccab27e9dac40ba (diff) | |
download | bash-completion-2c8171c38d87ddef31c92a76547d3fdf773a1337.tar.gz |
Imported Upstream version 1.90upstream/1.90
Diffstat (limited to 'completions/vncviewer')
-rw-r--r-- | completions/vncviewer | 43 |
1 files changed, 10 insertions, 33 deletions
diff --git a/completions/vncviewer b/completions/vncviewer index 296eb8af..46d6c617 100644 --- a/completions/vncviewer +++ b/completions/vncviewer @@ -1,6 +1,5 @@ -# bash completion for vncviewer +# bash completion for vncviewer -*- shell-script -*- -have vncviewer && _vncviewer_bootstrap() { local fname @@ -17,13 +16,10 @@ _vncviewer_bootstrap() } && complete -F _vncviewer_bootstrap vncviewer -have tightvncviewer && _tightvncviewer() { - local cur prev - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return case $prev in -passwd) @@ -58,13 +54,10 @@ complete -F _tightvncviewer tightvncviewer # NOTE: - VNC Viewer options are case insensitive. # Preferred case is taken from -help. # - Both single dash (-) and double dash (--) are allowed as option prefix -have xvnc4viewer && _xvnc4viewer() { - local cur prev - - COMPREPLY=() - _get_comp_words_by_ref cur prev + local cur prev words cword + _init_completion || return # Convert double dash to single dash case ${prev/#--/-} in @@ -98,33 +91,17 @@ _xvnc4viewer() ZlibLevel \ ) [[ "$cur" == --* ]] && dash=-- || dash=- - # Is a `nocasematch' variable available (bash > v3.1)? - if shopt nocasematch 2> /dev/null | command grep -q ^nocasematch; then - # Variable `nocasematch' is available - # Use vncviewer camelcase options - local option oldNoCaseMatch=$(shopt -p nocasematch) - shopt -s nocasematch - COMPREPLY=( $( for option in "${options[@]}"; do + + local option oldNoCaseMatch=$(shopt -p nocasematch) + shopt -s nocasematch + COMPREPLY=( $( for option in "${options[@]}"; do [[ $dash$option == "$cur"* ]] && printf '%s\n' $dash$option done ) ) - eval "$oldNoCaseMatch" 2> /dev/null - else - # Variable 'nocasematch' isn't available; - # Convert completions to lowercase - COMPREPLY=( $( compgen -W \ - "$( tr [:upper:] [:lower:] <<<${options[@]/#/$dash} )" \ - -- "$( tr [:upper:] [:lower:] <<<"$cur" )" ) ) - fi + eval "$oldNoCaseMatch" 2>/dev/null else _known_hosts_real "$cur" fi } && complete -F _xvnc4viewer xvnc4viewer -# Local variables: -# mode: shell-script -# sh-basic-offset: 4 -# sh-indent-comment: t -# indent-tabs-mode: nil -# End: # ex: ts=4 sw=4 et filetype=sh |