File: bash_completion.qemubuilder

package info (click to toggle)
cowdancer 0.73
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 752 kB
  • ctags: 269
  • sloc: ansic: 3,822; sh: 481; makefile: 191; cpp: 6
file content (47 lines) | stat: -rw-r--r-- 1,399 bytes parent folder | download | duplicates (4)
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
#!/bin/bash
# Debian GNU/Linux cowbuilder(1) completion
# Copyright 2007 Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
# Copyright 2009 Junichi Uekawa
#
# This script can be distributed under the same license as the
# cowdancer or bash packages.

have qemubuilder &&
_qemubuilder()
{
    local initialcommand initialcommand_options cur prev other_options distribution

    COMPREPLY=()
    cur=$(_get_cword)
    prev=${COMP_WORDS[COMP_CWORD-1]}
    initialcommand=${COMP_WORDS[1]}
    initialcommand_options='--create --update --build --login --execute'
    other_options='--dumpconfig --distribution --mirror --basepath --architecture'
    distribution='sid sarge etch woody lenny squeeze'

    case $initialcommand in
        --build)
            COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) 
		$( compgen -o filenames -G "$cur*.dsc" ) )
            ;;
        --execute)
            COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) 
		$( compgen -o filenames -G "$cur*" ) )
            ;;
        *)
            COMPREPLY=( $( compgen -W "$initialcommand_options" | grep "^$cur" ) 
		$( compgen -W "$other_options" | grep "^$cur" ) 
		)
            ;;
    esac

    case $prev in
	--distribution)
	    COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur"  ) )
	    ;;
	*)
    esac

    return 0
}
[ "$have" ] && complete -F _qemubuilder -o filenames qemubuilder