From 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:19 +0200 Subject: Merging upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- completions/xfreerdp | 63 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 26 deletions(-) (limited to 'completions/xfreerdp') 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 -- cgit v1.2.3