]> git.pld-linux.org Git - packages/bash-completion-pear.git/blame - pear
- new
[packages/bash-completion-pear.git] / pear
CommitLineData
8e6aaa2e
AG
1# pear completion by Amir Mohammad Saied <amirsaied@gmail.com>
2
3_pear()
4{
5 local cur prev commands
6 COMPREPLY=()
7 cur="${COMP_WORDS[COMP_CWORD]}"
8 prev="${COMP_WORDS[COMP_CWORD-1]}"
9 commands='build bundle channel-add channel-alias channel-delete \
10 channel-discover channel-info channel-update clear-cache \
11 config-create config-get config-help config-set config-show convert \
12 cvsdiff cvstag download download-all help info install list list-all \
13 list-channels list-files list-upgrades login logout makerpm package \
14 package-dependencies package-validate pickle remote-info remote-list \
15 run-scripts run-tests search shell-tests sign uninstall update-channels upgrade upgrade-all'
16
17 case "${prev}" in
18 build)
19 _filedir
20 return 0
21 ;;
22 bundle)
23 if [[ "${cur}" == -* ]] ; then
24 COMPREPLY=( $(compgen -W "-d -f --destination --force" -- ${cur}) )
25 fi
26 return 0
27 ;;
28 channel-@(alias|delete|info|update))
29 _discovered_channels
30 return 0
31 ;;
32 convert)
33 _filedir
34 if [[ "${cur}" == -* ]] ; then
35 COMPREPLY=( $(compgen -W "-f --flat" -- ${cur}) )
36 fi
37 return 0
38 ;;
39 cvsdiff)
40 if [[ "${cur}" == -* ]] ; then
41 COMPREPLY=( $(compgen -W "-q -Q -D -R -r -c -u -i -b -B -n \
42 --quiet --reallyquiet --date --release --revision \
43 --context --unified --ignore-case --ignore-whitespace \
44 --ignore-blank-lines --brief --dry-run" -- ${cur}) )
45 fi
46 _filedir
47 return 0
48 ;;
49 cvstag)
50 if [[ "${cur}" == -* ]] ; then
51 COMPREPLY=( $(compgen -W "-q -Q -F -d -n --quiet \
52 --reallyquiet --slide --delete--dry-run" -- ${cur}) )
53 fi
54 _filedir
55 return 0
56 ;;
57 download)
58 if [[ "${cur}" == -* ]] ; then
59 COMPREPLY=( $(compgen -W "-Z --nocompress" -- ${cur}) )
60 fi
61 return 0
62 ;;
63 download-all|remote-list)
64 if [[ "${cur}" == -* ]] ; then
65 COMPREPLY=( $(compgen -W "-c --channel" -- ${cur}) )
66 fi
67 return 0
68 ;;
69 install)
70 if [[ "${cur}" == -* ]] ; then
71 COMPREPLY=( $(compgen -W "-f -l -n -r -s -B -Z -R -P -a -o \
72 -O -p --force --loose --nodeps --register-only --soft \
73 --nobuild --nocompress --installroot --ignore-errors \
74 --alldeps --onlyreqdeps --offline --pretend" -- ${cur}) )
75 fi
76 return 0
77 ;;
78 list|search)
79 if [[ "${cur}" == -* ]] ; then
80 COMPREPLY=( $(compgen -W "-c -a -i --channel --allchannels --channelinfo" -- ${cur}) )
81 else
82 local packages=$(for p in `pear list | tail --lines=+4 | cut -d' ' -f1`; do echo ${p} ; done )
83 COMPREPLY=( $(compgen -W "${packages}" -- ${cur}) )
84 fi
85 return 0
86 ;;
87 list-all)
88 if [[ "${cur}" == -* ]] ; then
89 COMPREPLY=( $(compgen -W "-c -i --channel --channelinfo" -- ${cur}) )
90 fi
91 return 0
92 ;;
93 list-files)
94 local packages=$(for p in `pear list | tail --lines=+4 | cut -d' ' -f1`; do echo ${p} ; done )
95 COMPREPLY=( $(compgen -W "${packages}" -- ${cur}) )
96 return 0
97 ;;
98 list-upgrades)
99 if [[ "${cur}" == -* ]] ; then
100 COMPREPLY=( $(compgen -W "-i --channelinfo" -- ${cur}) )
101 fi
102 return 0
103 ;;
104 login)
105 _discovered_channels
106 return 0
107 ;;
108 makerpm)
109 if [[ "${cur}" == -* ]] ; then
110 COMPREPLY=( $(compgen -W "-t -p --spec-template --rpm-pkgname" -- ${cur}) )
111 fi
112 _filedir
113 return 0
114 ;;
115 p@(ackage|ickle))
116 if [[ "${cur}" == -* ]] ; then
117 COMPREPLY=( $(compgen -W "-Z -n --nocompress --showname" -- ${cur}) )
118 fi
119 _filedir
120 return 0
121 ;;
122 package-@(dependencies|validate))
123 _filedir
124 return 0
125 ;;
126 run-tests)
127 if [[ "${cur}" == -* ]] ; then
128 COMPREPLY=( $(compgen -W "-r -i -l -q -s -p -u -t -c -x \
129 --recur --ini --realtimelog --quiet --simple --package \
130 --phpunit --tapoutput --cgi --coverage" -- ${cur}) )
131 fi
132 return 0
133 ;;
134 sign)
135 if [[ "${cur}" == -* ]] ; then
136 COMPREPLY=( $(compgen -W "-v --verbose" -- ${cur}) )
137 fi
138 _filedir
139 return 0
140 ;;
141 u@(ninstall|pgrade)|run-scripts)
142 _installed_packages
143 return 0
144 ;;
145 upgrade-all)
146 if [[ "${cur}" == -* ]] ; then
147 COMPREPLY=( $(compgen -W "-n -r -B -Z -R --nodeps \
148 --register-only --nobuild --nocompress --installroot \
149 --ignore-errors --loose" -- ${cur}) )
150 fi
151 return 0
152 ;;
153 *)
154 ;;
155 esac
156
157 COMPREPLY=($(compgen -W "${commands}" -- ${cur}))
158 return 0
159}
160
161_installed_packages()
162{
163 local packages=$(for p in `pear list | tail --lines=+4 | cut -d' ' -f1`; do echo ${p} ; done )
164 COMPREPLY=( $(compgen -W "${packages}" -- ${cur}) )
165}
166
167_discovered_channels()
168{
169 local channels=$(for c in `pear list-channels | tail --lines=+4 | grep -v __uri | cut -d' ' -f1`; do echo ${c} ; done )
170 COMPREPLY=( $(compgen -W "${channels}" -- ${cur}) )
171
172}
173
174complete -F _pear pear
This page took 0.082858 seconds and 4 git commands to generate.