# bash completion for rdesktop -*- shell-script -*- proc _rdesktop { local cur prev words cword _init_completion -n : || return match $prev { with -k setglobal COMPREPLY = ''( $( command ls \ /usr/share/rdesktop/keymaps 2>/dev/null | \ command grep -E -v '(common|modifiers)' ) ) setglobal COMPREPLY = ''( $( command ls $HOME/.rdesktop/keymaps 2>/dev/null ) ) setglobal COMPREPLY = ''( $( command ls ./keymaps 2>/dev/null ) ) setglobal COMPREPLY = ''( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) return 0 with -a setglobal COMPREPLY = ''( $( compgen -W '8 15 16 24' -- "$cur" ) ) return 0 with -x setglobal COMPREPLY = ''( $( compgen -W 'broadband modem lan' -- "$cur" ) ) return 0 with -r match $cur { with sound:* setglobal COMPREPLY = ''( $( compgen -W 'local off remote' \ -- "${cur#sound:}" ) ) with *:* with * setglobal COMPREPLY = ''( $( compgen -W 'comport: disk: lptport: printer: sound: lspci scard' -- "$cur" ) ) [[ $COMPREPLY == *: ]] && compopt -o nospace } return 0 with -u|-d|-s|-c|-p|-n|-g|-S|-T|-X return 0 } if [[ "$cur" == -* ]] { local opts=( $( _parse_help "$1" ) ) setglobal COMPREPLY = ''( $( compgen -W '${opts[@]%:}' -- "$cur" ) ) } else { _known_hosts_real $cur } } && complete -F _rdesktop rdesktop # ex: ts=4 sw=4 et filetype=sh