[python] Improved to be able to build without gdbm, readline or zlib
[opensde-package-nopast.git] / shells / bashcompletion / rock-tools
blob75daf151c1358d5e6daa9bd6ca7b3f66db00b090
1 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # Filename: package/.../bashcompletion/rock-tools
5 # Copyright (C) 1998 - 2004 Clifford Wolf
7 # More information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License. A copy of the
12 # GNU General Public License can be found in the file COPYING.
13 # --- SDE-COPYRIGHT-NOTE-END ---
15 _interfaces() {
16         COMPREPLY=( $( compgen -W "$( command \
17                         sed -ne 's|^interface \([^ ]\+\).*$|\1|p' \
18                         /etc/network/config )" -- $cur ) )
21 _mine_installed_packages() {
22         COMPREPLY=( $( compgen -W "`(cd /var/adm/packages; echo *)`" -- $cur ) )
25 _mine() {
26         local cur prev
28         COMPREPLY=()
29         cur=${COMP_WORDS[COMP_CWORD]}
30         prev=${COMP_WORDS[COMP_CWORD-1]}
32         if [ $COMP_CWORD -eq 1 ]; then
33                 case "$cur" in
34                 *)
35                         COMPREPLY=( $( compgen -W '-i -r -q -p -l -m -c -d -k -C -T' \
36                                         -- $cur ) )
37                         ;;
38                 esac
40         return 0
41         fi
43         case "$prev" in
44         -R)
45                 _filedir -d
46                 return 0
47                 ;;
48         -k)
49                 COMPREPLY=( $( compgen -W 'pkg_name pkg_version pkg_tarbz2  \
50                                 pkg_config packages flists md5sums cksums   \
51                                 dependencies descs creator COPY I TITLE T   \
52                                 TEXT U URL A AUTHOR M MAINTAINER C CATEGORY \
53                                 F FLAG R ARCH ARCHITECTURE E DEP DEPENDENCY \
54                                 L LICENSE S STATUS V VER VERSION P PRI      \
55                                 PRIORITY CV-URL CV-PAT CV-DEL O CONF D DOWN \
56                                 DOWNLOAD SRC SOURCEPACKAGE' -- $cur ) )
57                 return 0
58         esac
60         case "${COMP_WORDS[1]}" in
61         -i)
62                 if [[ "$cur" == -* ]]; then
63                         COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
64                 else
65                         _filedir 'gem'
66                 fi
67                 ;;
68         -r)
69                 if [[ "$cur" == -* ]]; then
70                         COMPREPLY=( $( compgen -W '-t -v -f -R' -- $cur ) )
71                 else
72                         _mine_installed_packages
73                 fi
74                 ;;
75         -[qplmcd])
76                 if [[ "$cur" == -* ]]; then
77                         COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
78                 else
79                         _mine_installed_packages
80                         _filedir 'gem'
81                 fi
82                 ;;
83         -k)
84                 if [[ "$cur" == -* ]]; then
85                         COMPREPLY=( $( compgen -W '-h -H' -- $cur ) )
86                 else
87                         _filedir 'gem'
88                 fi
89                 ;;
90         -C)
91                 case "$COMP_CWORD" in
92                 2)
93                         _filedir -d
94                         ;;
95                 3)
96                         _filedir 'tar.bz2'
97                         ;;
98                 4)
99                         _mine_installed_packages
100                         ;;
101                 esac
102                 ;;
103         -T)
104                 case "$COMP_CWORD" in
105                 2|3)
106                         _filedir -d
107                         ;;
108                 4)
109                         _mine_installed_packages
110                         ;;
111                 esac
112         esac
114         return 0
116 complete -F _mine $filenames mine
118 _rc()
120         COMPREPLY=()
121         cur=${COMP_WORDS[COMP_CWORD]}
122         prev=${COMP_WORDS[COMP_CWORD-1]}
124         if [ $COMP_CWORD -eq 1 ]; then
125                 #first parameter on line
126                 if [ -r /etc/rc.d/init.d ]; then
127                 COMPREPLY=( $( compgen  -W "`(cd /etc/rc.d/init.d; echo *)`" \
128                                 -- $cur ) )
129                 fi
130         return 0
131         fi
133         if [ $COMP_CWORD -eq 2 ]; then
134                 #second parameter on line
135                 COMPREPLY=( $( compgen -W "$( command rc $prev help | \
136                         cut -d{ -f2 | tr -d '{}|' )" \
137                         -- $cur ) )
138         return 0
139         fi
141 complete -F _rc $filenames rc