File: vagrant.bash-completion

package info (click to toggle)
vagrant 1.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,084 kB
  • sloc: ruby: 15,045; python: 230; sh: 66; makefile: 2; lisp: 1
file content (63 lines) | stat: -rw-r--r-- 1,804 bytes parent folder | download
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
55
56
57
58
59
60
61
62
63
# bash completion for vagrant                              -*- shell-script -*-

_vagrant()
{
    local cur prev words cword
    _init_completion || return

    local command options

    commands="box destroy halt init package provision reload resume \
        ssh ssh-config status suspend up"

    if [[ $cword -eq 1 ]] ; then
        COMPREPLY=( $( compgen -W "$commands -h --help -v --version" -- "$cur" ) )
    else
        command=${words[1]}
        case $command in
            box)
                _count_args
                case $args in
                    2)
                        options='add list remove repackage'
                        ;;
                    3)
                        subcommand=${words[2]}
                        case $subcommand in
                            add)
                                options='-f --force'
                                ;;
                        esac
                        ;;
                esac
                ;;
            destroy)
                options='-f --force'
                ;;
            destroy|halt)
                options='-f --force'
                ;;
            init|provision|resume|status|suspend)
                options=''
                ;;
            package)
                options='--base --include --output --vagrantfile'
                ;;
            provision|reload|up)
                options='--no-provision --provision --provision-with'
                ;;
            ssh)
                options='-c --command -p --plain'
                ;;
            ssh-config)
                options='--host'
                ;;
        esac
        COMPREPLY=( $( compgen -W "$options -h --help" -- "$cur" ) )
    fi

   return 0
} &&
complete -F _vagrant vagrant

# ex: ts=4 sw=4 et filetype=sh