rdesktop: Use _parse_help, add/improve option completions and basic test case.
This commit is contained in:
parent
f9293cd3e8
commit
20a3d4d0bd
@ -5,7 +5,7 @@ have rdesktop || return
|
|||||||
_rdesktop()
|
_rdesktop()
|
||||||
{
|
{
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
_init_completion || return
|
_init_completion -n : || return
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-k)
|
-k)
|
||||||
@ -22,22 +22,33 @@ _rdesktop()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-x)
|
-x)
|
||||||
COMPREPLY=( $( compgen -W 'b broadband m modem l lan' \
|
COMPREPLY=( $( compgen -W 'broadband modem lan' -- "$cur" ) )
|
||||||
-- $cur ) )
|
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-r)
|
-r)
|
||||||
# FIXME: should do -o nospace for the colon options
|
case $cur in
|
||||||
COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
|
sound:*)
|
||||||
printer: sound: lspci scard' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W 'local off remote' \
|
||||||
|
-- "${cur#sound:}" ) )
|
||||||
|
;;
|
||||||
|
*:*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
COMPREPLY=( $( compgen -W 'comport: disk: lptport: \
|
||||||
|
printer: sound: lspci scard' -- "$cur" ) )
|
||||||
|
[[ $COMPREPLY == *: ]] && compopt -o nospace
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-u|-d|-s|-c|-p|-n|-g|-S|-T|-X)
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-u -d -s -c -p -n -k -g -f -b -L \
|
local opts=( $( _parse_help "$1" ) )
|
||||||
-A -B -e -E -m -C -D -K -S -T -N -X -a -z -x -P -r \
|
COMPREPLY=( $( compgen -W '${opts[@]%:}' -- "$cur" ) )
|
||||||
-0 -4 -5' -- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
_known_hosts_real "$cur"
|
_known_hosts_real "$cur"
|
||||||
fi
|
fi
|
||||||
|
1
test/completion/rdesktop.exp
Normal file
1
test/completion/rdesktop.exp
Normal file
@ -0,0 +1 @@
|
|||||||
|
assert_source_completions rdesktop
|
20
test/lib/completions/rdesktop.exp
Normal file
20
test/lib/completions/rdesktop.exp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
proc setup {} {
|
||||||
|
save_env
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
proc teardown {} {
|
||||||
|
assert_env_unmodified
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
setup
|
||||||
|
|
||||||
|
|
||||||
|
assert_complete_any "rdesktop -"
|
||||||
|
|
||||||
|
|
||||||
|
sync_after_int
|
||||||
|
|
||||||
|
|
||||||
|
teardown
|
Loading…
x
Reference in New Issue
Block a user