diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2009-11-12 19:34:34 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2009-11-12 19:34:34 +0000 |
commit | ffa186098c9f52c0ad84f57a62937db4d183c1c9 (patch) | |
tree | 5be50ec849b623c127dd05bec2f158676e1dae2c | |
parent | 31012c47d5dca7862f7962a583aaaa4deb98a50c (diff) | |
download | zsh-ffa186098c9f52c0ad84f57a62937db4d183c1c9.tar.gz zsh-ffa186098c9f52c0ad84f57a62937db4d183c1c9.tar.xz zsh-ffa186098c9f52c0ad84f57a62937db4d183c1c9.zip |
Baptiste Daroussin: 27379, 27381: BSD completions
-rw-r--r-- | Completion/BSD/Command/.distfiles | 3 | ||||
-rw-r--r-- | Completion/BSD/Command/_fstat | 15 | ||||
-rw-r--r-- | Completion/BSD/Command/_portmaster | 112 | ||||
-rw-r--r-- | Completion/BSD/Command/_procstat | 17 |
4 files changed, 147 insertions, 0 deletions
diff --git a/Completion/BSD/Command/.distfiles b/Completion/BSD/Command/.distfiles index fb17240f8..86530b8ea 100644 --- a/Completion/BSD/Command/.distfiles +++ b/Completion/BSD/Command/.distfiles @@ -6,10 +6,13 @@ _csup _cvsup _fetch _freebsd-update +_fstat _kld _pfctl _portaudit _portlint +_portmaster _portsnap _powerd +_procstat ' diff --git a/Completion/BSD/Command/_fstat b/Completion/BSD/Command/_fstat new file mode 100644 index 000000000..81948b21d --- /dev/null +++ b/Completion/BSD/Command/_fstat @@ -0,0 +1,15 @@ +#compdef fstat + +local pids +pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:}) + +_arguments -s \ +'-f[Restrict examination to files open in the same file systems as the named file arguments]' \ +'-M[Extract values associated with the name list from the specified core]:core:_files' \ +'-N[Extract the name list from the specified system]:system:' \ +'-m[Include memory-mapped files in the listing]' \ +'-n[Numerical format]' \ +'-p[Report all files open by the specified process]:Process id:(($pids))' \ +'-u[Report all files open by the specified user]:User:_users' \ +'-v[Verbose mode]' \ +'*:Files:_files' diff --git a/Completion/BSD/Command/_portmaster b/Completion/BSD/Command/_portmaster new file mode 100644 index 000000000..0fd34dc60 --- /dev/null +++ b/Completion/BSD/Command/_portmaster @@ -0,0 +1,112 @@ +#compdef portmaster + +_portmaster_pkgs() { + compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t) +} + +_portmaster_ports() { + local ret=1 _fbsd_ports _fbsd_cat + _fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t)) + if [[ $PREFIX != */* ]] ; then + _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat + else + compset -P '*/' + _fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t)) + _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports + fi + return ret +} + +_portmaster_pkgs_and_ports() { + local ret=1 + _portmaster_pkgs && ret=0 + _portmaster_ports && ret=0 + + return ret +} + +_portmaster() { + local specific_args common_args expunge_args standalone_args kid + standalone_args=( + '--clean-distfiles[delete distfiles not associated with an installed ports: interactive]' + '--clean-distfiles-all[delete distfiles not associated with an installed ports]' + '--check-depends[cross-check and update dependency information for all ports]' + '--check-port-dbdir[check for stale entries in /var/db/ports]' + '--list-origins[list directories from /usr/ports for root and leaf ports]' + '-l[list all installed ports by category]' + '-L[list all installed ports by category, and search for updates]' + {'(-help)-h','(-h)--help'}'[display help message]:' + '--version[display the version only]:' + ) + specific_args=( + '(-s -r -o)-e[expunge port using pkg_delete, and remove all distfiles]:name of port:_portmaster_pkgs' + '(-e -r -o)-s[clean out stale ports that used to be depended on]' + '(-e -s -o)-r[rebuild the specified port, and all ports that depend on it]:name/glob of port:_portmaster_pkgs' + '(-e -s -r)-o[replace the installed port with a port from a different origin]:new port dir:_portmaster_ports' + ) + expunge_args=( + '(-b)-B[prevents creation of the backup package for the installed port]' + '(-d)-D[no cleaning of distfiles]' + '(-D)-d[always clean distfiles]' + ) + common_args=( + "(-G)--force-config[run 'make config' for all ports]" + "-C[prevents 'make clean' from being run before building]" + '-H[hide details of the port build and install in a log file]' + "-K[prevents 'make clean' from being run after building]" + '(-B)-b[create and keep a backup package of an installed port]' + '-g[create a package of the new port]' + '-n[run through configure, but do not make or install any ports]' + '-t[recurse dependencies thoroughly, using all-depends-list]' + '-v[verbose output]' + '-w[save old shared libraries before deinstall]' + '-u[unattended mode]' + '(-i)-f[always rebuild ports]' + '(-f)-i[interactive update mode]' + '-m[any arguments to supply to make]:arguments for make:' + '-x[avoid building or updating ports that match this pattern]:glob pattern to exclude from building:' + '-p[specify the full path to a port directory]:a port directory:' + '--show-work[show what dependent ports are, and are not installed]' + '-R[restart an update, skipping ports already up to date]' + '-a[check all ports, update as necessary]' + '-F[fetch distfiles only]' + $expunge_args + $specific_args + ) + if (( CURRENT == 2 ));then + _arguments -s \ + $standalone_args \ + $common_args \ + '*:Packages and Ports:_portmaster_pkgs_and_ports' + else + case "$words[2]" in + --clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h) + return 0 + ;; + *) + if (( $words[(I)-(e|r)] ));then + _arguments -s \ + '*:Packages:_portmaster_pkgs' + elif (( kid=$words[(I)-o] ));then + if (( CURRENT == $kid + 1 ));then + _arguments -s \ + '*:Ports replacing:_portmaster_ports' + elif (( CURRENT == $kid + 2 )); then + _arguments -s \ + '*:Package to replace:_portmaster_pkgs' + else + return 0 + fi + elif (( $words[(I)-s] ));then + return 0 + else + _arguments -s \ + $common_args \ + '*:Packages and Ports:_portmaster_pkgs_and_ports' + fi + ;; + esac + fi + } + + _portmaster "$@" diff --git a/Completion/BSD/Command/_procstat b/Completion/BSD/Command/_procstat new file mode 100644 index 000000000..b6343beff --- /dev/null +++ b/Completion/BSD/Command/_procstat @@ -0,0 +1,17 @@ +#compdef procstat + +local pids +#get list of pids and associated process name as comment +pids=(${${${(f)"$(/usr/bin/procstat -ah)"}/[[:space:]]#/}/[[:space:]]*[[:space:]](ELF[[:digit:]]#[[:space:]]|-[[:space:]]#)/:}) + +_arguments -s \ +'-b[Display binary information for the process]' \ +'-c[Display command line arguments for the process]' \ +'-f[Display file descriptor information for the process]' \ +'-k[Display the stacks of kernel threads in the process]' \ +'-s[Display security credential information for the process]' \ +'-t[Display thread information for the process]' \ +'-v[Display virtual memory mappings for the process]' \ +'-h[Suppress table headers.]' \ +'-a[All processes]' \ +':Process id:(($pids))' |