File: cowbuilder

package info (click to toggle)
cowdancer 0.89
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 648 kB
  • sloc: ansic: 4,596; sh: 407; makefile: 144; cpp: 5
file content (54 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (2)
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
# Debian GNU/Linux cowbuilder(1) completion
# Copyright 2007 Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
# Copyright 2011 David Paleino <dapal@debian.org>
# Copyright 2020 Joao Eriberto Mota Filho <eriberto@debian.org>
#
# This script can be distributed under the same license as the
# cowdancer or bash packages.

_have cowbuilder &&
_cowbuilder()
{
    local initialcommand initialcommand_options cur prev words other_options distribution

    COMPREPLY=()
    _get_comp_words_by_ref cur prev words
    initialcommand=${words[1]}
    initialcommand_options='create --create update --update build --build login --login execute --execute'
    other_options='--dumpconfig --distribution --mirror --basepath --architecture --configfile'
    distribution='sid jessie stretch buster bullseye bookworm'

    case $prev in
	--distribution)
	    COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur"  ) )
	    return 0
	    ;;
	--basepath)
	    _filedir -d
	    return 0
	    ;;
	--configfile)
	    _filedir
	    return 0
	    ;;
	*)
	    ;;
    esac

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

    return 0
} &&
complete -F _cowbuilder cowbuilder