summaryrefslogtreecommitdiff
blob: 8dc5cc1bc04bb6ce31996b39af0dba67a56635f1 (plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
diff -urN gentoo-bashcomp-20050117.orig/gentoo gentoo-bashcomp-20050117/gentoo
--- gentoo-bashcomp-20050117.orig/gentoo	2005-01-31 03:41:52.876228512 -0500
+++ gentoo-bashcomp-20050117/gentoo	2005-01-31 04:07:55.467678504 -0500
@@ -750,7 +750,8 @@
 	for i in "${COMP_WORDS[@]}"; do
 		if [ $j -lt $COMP_CWORD ]; then
 			j=$((j + 1))
-			case $i in @(belongs|ch@(anges|eck)|dep@(ends|graph)|files|glsa|list|s@(ize|tats)|uses|which|hasuse))
+			case $i in
+                            @(belongs|ch@(anges|eck)|dep@(ends|graph)|files|glsa|list|s@(ize|tats)|uses|which|hasuse|b|c|k|d|g|f|a|h|l|s|t|u|w))
 				mode=$i
 				;;
 			esac
@@ -769,11 +770,11 @@
 					;;
 			esac
 			;;
-		changes|glsa|stats)
+		c?(hanges)|a|glsa|t|stats)
 			# These commands have not been implemented in 'equery' yet ...
 			echo -n "# Not implemented! "
 			;;
-		files)
+		f?(iles))
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -788,7 +789,7 @@
 				esac
 			fi
 			;;
-		list)
+		l?(ist))
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -803,7 +804,7 @@
 				esac
 			fi
 			;;
-		belongs)
+		b?(elongs))
 			# Only complete if the previous entry on the command line is not
 			# a file name.
 			if \
@@ -823,8 +824,8 @@
 						COMPREPLY=($(compgen -W "-c --category -e --earlyout" -- $cur))
 						;;
 					*)
-						# Complete filenames. Function defined in /etc/bash_completion.
-						_filedir
+                                                COMPREPLY=($(compgen -f -- $cur) \
+                                                    $(compgen -d -S '/' -- $cur))
 						;;
 				esac
 			# Are we completing a category?
@@ -832,7 +833,7 @@
 				COMPREPLY=($(cd ${portdir}/metadata/cache; compgen -W "$(compgen -G '*')" -- $cur))
 			fi
 			;;
-		uses|which)
+		@(u?(ses)|w?(hich)))
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} ]]; then
@@ -840,7 +841,7 @@
 				_pkgname -A $cur
 			fi
 			;;
-		depgraph)
+		g|depgraph)
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -855,7 +856,7 @@
 				esac
 			fi
 			;;
-		depends)
+		d?(epends))
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -878,7 +879,7 @@
 				esac
 			fi
 			;;
-		check)
+		k|check)
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} ]]; then
@@ -886,7 +887,7 @@
 				_pkgname -I $cur
 			fi
 			;;
-		size)
+		s?(ize))
 			# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -901,7 +902,7 @@
 				esac
 			fi
 			;;
-		hasuse)
+		h?(asuse))
 		   	# Only complete if the previous entry on the command line is not
 			# a package name.
 			if [[ ${prev} == ${mode} || ${prev:0:1} == "-" ]]; then
@@ -921,7 +922,7 @@
 	esac
 	return 0
 }
-complete -F _equery -o filenames equery
+complete -F _equery equery
 }
 
 #