Add _procstat (complete) remove the entry in todolist
[zfbsd.git] / _portmaster
blob92fa9673dbbc0a1f49f68565c450739cb4e10064
1 #compdef portmaster
3 (( $+functions[_portmaster_pkgs] )) ||
4 _portmaster_pkgs() {
5   compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
8 (( $+functions[_portmaster_ports] )) ||
9 _portmaster_ports() {
10   local ret=1 available_ports
11 #  if ( [[ $+_fbsd_ports -eq 0 ]] || _cache_invalid FBSD_PORTS ) && ! _retrieve_cache FBSD_PORTS ;then
12 #    typeset -gaU _fbsd_ports
13 #    _fbsd_ports=(${PORTSDIR:-/usr/ports}/[a-z]*/*(/:s#${PORTSDIR:-/usr/ports/}#)) 
14 ##    _fbsd_ports=(${_fbsd_ports%%/})
15 #    _store_cache FBSD_PORTS _fbsd_ports 
16 #  fi
18 #  _wanted cat_packages expl 'category/ports' _multi_parts "$@" / _fbsd_ports
19 #  _path_files "$@" -W ${PORTSDIR:-/usr/ports} -/ -g [a-z]*  && ret=0
20    _fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t))
21    if [[ $PREFIX != */* ]] ; then
22      _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat
23    else
24      compset -P '*/'
25      _fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t))
26      _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports
27    fi
28   return ret
31 (( $+functions[_portmaster_pkgs_and_ports] )) ||
32 _portmaster_pkgs_and_ports() {
33   local ret=1
34   _portmaster_pkgs && ret=0
35   _portmaster_ports && ret=0
37   return ret
40 _portmaster() {
41   local specific_args common_args expunge_args standalone_args kid
42   standalone_args=(
43   '--clean-distfiles[delete distfiles not associated with an installed ports: interactive]'
44   '--clean-distfiles-all[delete distfiles not associated with an installed ports]'
45   '--check-depends[cross-check and update dependency information for all ports]'
46   '--check-port-dbdir[check for stale entries in /var/db/ports]'
47   '-l[list all installed ports by category]'
48   '-L[list all installed ports by category, and search for updates]'
49   {'(-help)-h','(-h)--help'}'[display help message]:'
50     '--version[display the version only]:'
51     )
52     specific_args=(
53     '(-s -r -o)-e[expunge port using pkg_delete, and remove all distfiles]:name of port:_portmaster_pkgs'
54     '(-e -r -o)-s[clean out stale ports that used to be depended on]'
55     '(-e -s -o)-r[rebuild the specified port, and all ports that depend on it]:name/glob of port:_portmaster_pkgs'
56     '(-e -s -r)-o[replace the installed port with a port from a different origin]:new port dir:_portmaster_ports'
57     )
58     expunge_args=(
59     '(-b)-B[prevents creation of the backup package for the installed port]'
60     '(-d)-D[no cleaning of distfiles]'
61     '(-D)-d[always clean distfiles]'
62     )
63     common_args=(
64     "(-G)--force-config[run 'make config' for all ports]" 
65     "-C[prevents 'make clean' from being run before building]"
66     '-H[hide details of the port build and install in a log file]'
67     "-K[prevents 'make clean' from being run after building]"
68     '(-B)-b[create and keep a backup package of an installed port]'
69     '-g[create a package of the new port]'
70     '-n[run through configure, but do not make or install any ports]'
71     '-t[recurse dependencies thoroughly, using all-depends-list]'
72     '-v[verbose output]'
73     '-w[save old shared libraries before deinstall]'
74     '-u[unattended mode]'
75     '(-i)-f[always rebuild ports]'
76     '(-f)-i[interactive update mode]'
77     '-m[any arguments to supply to make]:arguments for make:'
78     '-x[avoid building or updating ports that match this pattern]:glob pattern to exclude from building:'
79     '-p[specify the full path to a port directory]:a port directory:'
80     '--show-work[show what dependent ports are, and are not installed]'
81     '-R[restart an update, skipping ports already up to date]' 
82     '-a[check all ports, update as necessary]'
83     '-F[fetch distfiles only]'
84     $expunge_args
85     $specific_args
86     )
87     if (( CURRENT == 2 ));then
88       _arguments -s \
89       $standalone_args \
90       $common_args \
91       '*:Packages and Ports:_portmaster_pkgs_and_ports'
92     else 
93       case "$words[2]" in
94         --clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h)
95         return 0
96         ;;
97         *)
98         if (( $words[(I)-(e|r)] ));then
99           _arguments -s \
100           '*:Packages:_portmaster_pkgs'
101         elif (( kid=$words[(I)-o] ));then
102           if (( CURRENT == $kid + 1 ));then
103             _arguments -s \
104             '*:Ports replacing:_portmaster_ports'
105           elif (( CURRENT == $kid + 2 )); then
106             _arguments -s \
107             '*:Package to replace:_portmaster_pkgs'
108           else 
109             return 0
110           fi
111         elif (( $words[(I)-s] ));then
112           return 0
113         else
114           _arguments -s \
115           $common_args \
116           '*:Packages and Ports:_portmaster_pkgs_and_ports'
117         fi
118         ;;
119       esac
120     fi
121   }
123   _portmaster "$@"