File: apt-file.bash_completion

package info (click to toggle)
apt-file 2.0.8.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 128 kB
  • ctags: 27
  • sloc: perl: 335; makefile: 64; sh: 4
file content (39 lines) | stat: -rw-r--r-- 783 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
have apt-file &&
_apt-file()
{
	local cur prev special i

	COMPREPLY=()
	cur=${COMP_WORDS[COMP_CWORD]}
	prev=${COMP_WORDS[COMP_CWORD-1]}

	for (( i=0; i < ${#COMP_WORDS}-1; i++ )); do
		if [[ ${COMP_WORDS[i]} == @(list) ]]; then
			special=${COMP_WORDS[i]}
		fi
	done

	if [ -n "$special" ]; then
            COMPREPLY=( $( apt-cache pkgnames $cur 2> /dev/null ) )
            return 0
        fi

	if [[ "$cur" == -* ]]; then

		COMPREPLY=( $( compgen -W '-c -v -V -a -s -l -F -y -H \
				--cache --verbose --version --architecture \
				--sources-list --package-only --fixed-string \
				--dummy --help' -- $cur ) )
	else

		COMPREPLY=( $( compgen -W 'update search list \
                                show purge' -- $cur ) )

	fi


	return 0

}
complete -F _apt-file apt-file