File: dsh.bash_completion

package info (click to toggle)
dsh 0.25.10-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,132 kB
  • sloc: sh: 9,667; ansic: 1,102; makefile: 100
file content (33 lines) | stat: -rw-r--r-- 763 bytes parent folder | download | duplicates (3)
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
### Bash-completion for dsh.
### Copyright 2011  Jordi Funollet <jordi.f@ati.es>
### Distributed under the terms and conditions of GPL version 2

_dsh() {
    _get_comp_words_by_ref cur prev
    COMPREPLY=()

    case "${prev}" in
        -m|--machine)
            _known_hosts_real "${cur}"
            return 0
            ;;
        -f|--file)
            _filedir
            return 0
            ;;
        -g|--group)
            local groups=$(cd ~/.dsh/group/ && find *)
            COMPREPLY=( $(compgen -W "${groups}" -- "${cur}") )
            return 0
            ;;
        *)
            ;;
    esac
    
    opts="$(dsh --help | awk '/^-/ {print $1,$2}')"
    COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
    return 0
}

complete -F _dsh dsh