diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
commit | f2621414ee5f2f601424c22f00e207903e3b6104 (patch) | |
tree | 56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/xfreerdp | |
parent | Adding debian version 1:2.11-8. (diff) | |
download | bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/xfreerdp')
-rw-r--r-- | completions/xfreerdp | 63 |
1 files changed, 37 insertions, 26 deletions
diff --git a/completions/xfreerdp b/completions/xfreerdp index f17414f..66b42ad 100644 --- a/completions/xfreerdp +++ b/completions/xfreerdp @@ -1,67 +1,78 @@ # xfreerdp completion -*- shell-script -*- -_xfreerdp() +_comp_cmd_xfreerdp() { - local cur prev words cword - _init_completion -n : || return + local cur prev words cword comp_args + _comp_initialize -n : -- "$@" || return - case $prev in # old/dash syntax + case $prev in -k) - COMPREPLY=($(compgen -W '$("$1" --kbd-list | - awk "/^0x/ { print \$1 }")' -- "$cur")) + _comp_compgen_split -- "$("$1" --kbd-list | + _comp_awk '/^0x/ { print $1 }')" return ;; -a) - COMPREPLY=($(compgen -W '8 15 16 24 32' -- "$cur")) + _comp_compgen -- -W '8 15 16 24 32' return ;; -x) - COMPREPLY=($(compgen -W 'broadband modem lan' -- "$cur")) + _comp_compgen -- -W 'broadband modem lan' return ;; --plugin) - COMPREPLY=($(compgen -W 'cliprdr rdpsnd rdpdr' -- "$cur")) + _comp_compgen -- -W 'cliprdr rdpsnd rdpdr' + return + ;; + /help | /version | -h | --help | --version) return ;; esac - case $cur in # new/slash syntax + case $cur in /kbd:*) - COMPREPLY=($(compgen -W '$("$1" /kbd-list | - awk "/^0x/ { print \$1 }")' -- "${cur#/kbd:}")) + local kbd_list + kbd_list=$("$1" /kbd-list 2>/dev/null) || + kbd_list=$("$1" /list:kbd 2>/dev/null) + _comp_compgen -c "${cur#/kbd:}" split -- "$( + _comp_awk '/^0x/ { print $1 }' <<<"$kbd_list" + )" return ;; /bpp:*) - COMPREPLY=($(compgen -W '8 15 16 24 32' -- "${cur#/bpp:}")) + _comp_compgen -c "${cur#/bpp:}" -- -W '8 15 16 24 32' return ;; - /*:* | /help | /version | -h | --help | --version) + /*:*) return ;; esac if [[ $cur == /* ]]; then - COMPREPLY=($(compgen -W '$("$1" --help | - awk "\$1 ~ /^\\// && \$1 !~ /^.(flag\$|option:)/ { sub(\":.*\",\":\",\$1); print \$1 }")' \ - -- "$cur")) + _comp_compgen_filedir rdp + _comp_compgen -a split -- "$( + "$1" --help | _comp_awk '$1 ~ /^\// && $1 !~ /^.(flag$|option:)/ { + sub(":.*",":",$1); print $1 }' + )" [[ ${COMPREPLY-} == *: ]] && compopt -o nospace elif [[ $cur == [+-]* ]]; then local char=${cur:0:1} - local help="$($1 --help)" + local help="$("$1" --help)" if [[ $help == */help* ]]; then # new/slash syntax - COMPREPLY=($(compgen -W '$(awk " - \$1 ~ /^[+-]/ && \$1 !~ /^.toggle\$/ { sub(\"^.\",\"$char\",\$1); print \$1 } - " <<<"$help")' -- "$cur")) + _comp_compgen_split -- "$(_comp_awk '$1 ~ /^[+-]/ && $1 !~ /^.toggle$/ { + sub("^.","'"$char"'",$1); print $1 }' <<<"$help")" else # old/dash syntax - COMPREPLY=($(_parse_help - <<<"$help")) - COMPREPLY=($(compgen -W '${COMPREPLY[@]%:}' -- "$cur")) + _comp_compgen -R help - <<<"$help" + ((${#COMPREPLY[@]})) && + _comp_compgen -- -W '"${COMPREPLY[@]%:}"' fi else - COMPREPLY=($(compgen -W "$(awk '{print $1}' ~/.freerdp/known_hosts \ - 2>/dev/null)" -- "$cur")) + _comp_compgen_filedir rdp + _comp_compgen -a split -- "$( + _comp_awk '{print $1}' ~/.freerdp/known_hosts 2>/dev/null + )" fi } && - complete -F _xfreerdp xfreerdp + complete -F _comp_cmd_xfreerdp xfreerdp # ex: filetype=sh |