summaryrefslogtreecommitdiffstats
path: root/completions/rdesktop
blob: 42d2ccbba3c0190d4f41ccd4f8b9c75a0057993d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# bash completion for rdesktop                             -*- shell-script -*-

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

    case $prev in
        -*k)
            _comp_expand_glob COMPREPLY '/usr/share/rdesktop/keymaps/!(*@(common|modifiers)*) {"$HOME/.rdesktop",.}/keymaps/*' &&
                _comp_compgen -- -W '"${COMPREPLY[@]}"'
            return
            ;;
        -*a)
            _comp_compgen -- -W '8 15 16 24'
            return
            ;;
        -*x)
            _comp_compgen -- -W 'broadband modem lan'
            return
            ;;
        -*r)
            case $cur in
                sound:*)
                    _comp_compgen -c "${cur#sound:}" -- -W 'local off remote'
                    ;;
                *:*) ;;

                *)
                    _comp_compgen -- -W 'comport: disk: lptport: printer:
                        sound: lspci scard'
                    [[ ${COMPREPLY-} == *: ]] && compopt -o nospace
                    ;;
            esac
            return
            ;;
        -*[udscpngSTX])
            return
            ;;
    esac

    if [[ $cur == -* ]]; then
        local -a opts
        _comp_compgen -Rv opts help
        ((${#opts[@]})) &&
            _comp_compgen -- -W '"${opts[@]%:}"'
    else
        _comp_compgen_known_hosts -- "$cur"
    fi

} &&
    complete -F _comp_cmd_rdesktop rdesktop

# ex: filetype=sh