blob: 57dfc0163b47a21edd13a1571325d9cc1e5b8b80 (
plain)
1 # prt-get(8), prt-cache(8) completion by Johannes Winkelmann, jw@tks6.net
2 # problems: options ending on = should not add a space afterwards
3 #
4 # 07.07.2002: use prt-get listinst (from 0.3.1pre1) instead of pkginfo
5 # 06.07.2002: first version
6
7 _prt-get()
8 {
9 local cur prev
10
11 COMPREPLY=()
12 cur=${COMP_WORDS[COMP_CWORD]}
13 prev=${COMP_WORDS[COMP_CWORD-1]}
14
15 if [ $COMP_CWORD -eq 1 ]; then
16 COMPREPLY=( $( compgen -W ' \
17 install depinst update grpinst help \
18 version readme list info path \
19 search dsearch fsearch printf cache \
20 dependent sysup current lock unlock \
21 listlocked diff quickdiff depends quickdep \
22 dup isinst cat ls edit deptree \
23 remove listinst dumpconfig listofphans' $cur ))
24 fi
25
26
27 if [ $COMP_CWORD '>' 1 ]; then
28 if [[ "$cur" != -* ]]; then
29 case ${COMP_WORDS[1]} in
30 "install" | "depinst" | "grpinst" | "path" | "dependent" | \
31 "depends" | "quickdep" | "info" | "readme" | \
32 "ls" | "isinst" | "deptree" )
33 if [ -f /var/lib/pkg/prt-get.cache ]; then
34 plist=`prt-cache list`
35 if [ ! "$plist" == "" ]; then
36 COMPREPLY=( $( compgen -W '$plist' $cur ) )
37 fi
38 fi
39 ;;
40 "cat" | "edit" )
41 if [ $COMP_CWORD '>' 2 ]; then
42 plist=`prt-get ls ${COMP_WORDS[2]}`
43 COMPREPLY=( $( compgen -W '$plist' $cur ) )
44 else
45 if [ -f /var/lib/pkg/prt-get.cache ]; then
46 plist=`prt-cache list`
47 if [ ! "$plist" == "" ]; then
48 COMPREPLY=( $( compgen -W '$plist' $cur ) )
49 fi
50 fi
51 fi
52 ;;
53 "current"|"lock"|"remove")
54 plist=`prt-get listinst`
55 COMPREPLY=( $( compgen -W '$plist' $cur ) )
56 ;;
57 "update")
58 plist=`prt-get quickdiff`
59 COMPREPLY=( $( compgen -W '$plist' $cur ) )
60 ;;
61 "unlock")
62 plist=`prt-get listlocked`
63 COMPREPLY=( $( compgen -W '$plist' $cur ) )
64 ;;
65 esac
66 else
67 case ${COMP_WORDS[1]} in
68 "install" | "update" | "groupinst")
69 COMPREPLY=( $( compgen -W '--config= --cache \
70 --pre-install \
71 --post-install \
72 --install-scripts \
73 --log --test \
74 --config \
75 --config-append= \
76 --config-prepend= \
77 --config-set= \
78 --aargs= --margs= \
79 --rargs= \
80 --install-root=' \
81 -- $cur ) )
82 ;;
83 "list" | "search" | "dsearch" )
84 COMPREPLY=( $( compgen -W '-v -vv --cache \
85 --config=' -- $cur ) )
86 ;;
87 *)
88 COMPREPLY=( $( compgen -W '--cache --log --test --config=' \
89 -- $cur ) )
90 ;;
91 esac
92 fi
93 fi
94
95 return 0
96 }
97 complete -F _prt-get -o default prt-get
98 complete -F _prt-get -o default prt-cache
|