File: bash_completion

package info (click to toggle)
dput 0.9.6.1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 232 kB
  • ctags: 109
  • sloc: python: 1,487; makefile: 61; sh: 24
file content (48 lines) | stat: -rw-r--r-- 1,309 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
48
#-*- mode: shell-script;-*-

# Debian GNU/Linux dput(1) completion
# Copyright 2002 Roland Mas <lolando@debian.org>

have dput &&
_dput()
{
    local cur prev options paroptions special i delayed_options hosts
    
    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    options='-c --config -d --debug -D --dinstall -f --force -h --help \
             -H --host-list -l --lintian -o --check-only -p --print \
             -P --passive -s --simulate -u --unchecked -e --delayed \
             -v --version -V --check-version'

    hosts=$(
	{
	    grep "^\[.*\]" $HOME/.dput.cf 2> /dev/null | tr -d [] || /bin/true
	    grep "^\[.*\]" /etc/dput.cf 2> /dev/null | tr -d [] || /bin/true
	} | grep -v '^DEFAULT$' | sort -u)

    paroptions="$options $hosts"

    case $prev in
	--delayed|-e)
	    delayed_options='0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15'
	    COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
	    ;;
	--config|-c)
	    COMPREPLY=( $( compgen -o filenames -G "$cur*" ) )
	    ;;
	*)
	    COMPREPLY=( $(
		    compgen -G "${cur}*.changes"
		    compgen -G "${cur}*.asc"
		    compgen -G "${cur}*.sig"
		    compgen -W "$paroptions" | grep "^$cur"
		) )
	    ;;
    esac

    return 0

}
[ "$have" ] && complete -F _dput -o filenames -o plusdirs dput