Skip to content

fix(xfreerdp): try /list:kbd also with dash syntax #1373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions completions/xfreerdp
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# xfreerdp completion -*- shell-script -*-

_comp_cmd_xfreerdp__kbd_list()
{
local kbd_list
# Trying non deprecated /list:kbd first
kbd_list=$("$1" /list:kbd 2>/dev/null) ||
# Old syntax, deprecated in 2022-10-19
# See https://github.com/FreeRDP/FreeRDP/commit/119b8d4474ab8578101f86226e0d20a53460dd51
kbd_list=$("$1" /kbd-list 2>/dev/null)
_comp_awk '/^0x/ { print $1 }' <<<"$kbd_list"
}

_comp_cmd_xfreerdp()
{
local cur prev words cword comp_args
_comp_initialize -n : -- "$@" || return

case $prev in
-k)
_comp_compgen_split -- "$("$1" --kbd-list |
_comp_awk '/^0x/ { print $1 }')"
_comp_compgen_split -- "$(_comp_cmd_xfreerdp__kbd_list "$1")"
return
;;
-a)
Expand All @@ -30,12 +40,7 @@ _comp_cmd_xfreerdp()

case $cur in
/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"
)"
_comp_compgen -c "${cur#/kbd:}" split -- "$(_comp_cmd_xfreerdp__kbd_list "$1")"
return
;;
/bpp:*)
Expand Down
Loading