Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: compdef's for FreeBSD



Akinori -Aki- MUSHA wrote:

> ...
> 
> So here I attach some useful compdef's for FreeBSD environments, and
> we would be very happy if you would include them in your source tree
> for us.

I've re-hacked and added them.

Bye
 Sven

Index: Completion/Bsd/.distfiles
===================================================================
RCS file: .distfiles
diff -N .distfiles
--- /dev/null	Tue May  5 13:32:27 1998
+++ .distfiles	Thu Apr 20 02:42:24 2000
@@ -0,0 +1,4 @@
+DISTFILES_SRC='
+    .distfiles
+    _bsd_pkg _cvsup _kld
+'
Index: Completion/Bsd/_bsd_pkg
===================================================================
RCS file: _bsd_pkg
diff -N _bsd_pkg
--- /dev/null	Tue May  5 13:32:27 1998
+++ _bsd_pkg	Thu Apr 20 02:42:24 2000
@@ -0,0 +1,68 @@
+#compdef pkg_add pkg_delete pkg_info
+
+(( $+functions[_bsd_pkg_packages] )) ||
+_bsd_pkg_packages() {
+  local ret=1 paths
+
+  paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
+  _files "$@" -g \*.tgz && ret=0
+  (( $#path )) && _files "$@" -W paths -g \*.tgz && ret=0
+  compadd "$@" - /usr/ports/packages/All/*.tgz && ret=0
+
+  return ret
+}
+
+_bsd_pkg() {
+  case "${words[1]:t}" in
+  pkg_add)
+    _arguments -s \
+        '-v[be verbose]' \
+	'-I[don'\''t execute installation scripts]' \
+	'-n[don'\''t really install packages]' \
+	'-R[don'\''t record]' \
+	'-r[use remote fetching]' \
+	'-f[force installation]' \
+	'-M[run in master mode]' \
+	'-S[run in slave mode]' \
+        '-t:mktemp template:_files -/' \
+        '-p:prefix directory:_files -/' \
+        '*:package to install:_bsd_pkg_packages'
+    ;;
+
+  pkg_delete)
+    _arguments -s \
+        '-v[be verbose]' \
+	'-D[don'\''t execute deinstallation scripts]' \
+	'-n[don'\''t really deinstall packages]' \
+	'-d[remove empty directories]' \
+	'-f[force deinstallation]' \
+        '-p:prefix directory:_files -/' \
+        '*:package to deinstall:compadd - /var/db/pkg/*(\:t)'
+    ;;
+
+  pkg_info)
+    _arguments -s \
+        '(:)-a[show all installed packages]' \
+	'-v[be verbose]' \
+	'-p[show installation prefixes]' \
+	'-q[be quiet]' \
+	'-c[show comment fields]' \
+	'-d[show long descriptions]' \
+	'-D[show install-message files]' \
+        '-f[show packing list instrcutions]' \
+	'-i[show install scripts]' \
+	'-I[show index lines]' \
+	'-k[show deinstall scripts]' \
+	'-r[show requirements scripts]' \
+	'-R[show list list of installed requiring packages]' \
+	'-m[show mtree files]' \
+	'-L[show full pathnames of files]' \
+        '-e[test if package is installed]:package name:compadd - /var/db/pkg/*(\:t)' \
+        '-l:prefix directory:_files -/' \
+        '-t:mktemp template:_files -/' \
+        '(-a)*:package name:compadd - /var/db/pkg/*(\:t)'
+    ;;
+  esac
+}
+
+[[ -o kshautoload ]] || _bsd_pkg "$@"
Index: Completion/Bsd/_cvsup
===================================================================
RCS file: _cvsup
diff -N _cvsup
--- /dev/null	Tue May  5 13:32:27 1998
+++ _cvsup	Thu Apr 20 02:42:24 2000
@@ -0,0 +1,27 @@
+#compdef cvsup
+
+_arguments -s \
+    '-1[disable automatic retries]' \
+    '-a[server must athenticate itself]' \
+    '-A:local adress:_hosts' \
+    '-b:base directory:_files -/' \
+    '-c:collections directory:_files -/' \
+    '-d:maximum number of deleted files:' \
+    '-D[perform only deletions]' \
+    '(-E)-e[enable execution of commands from server]' \
+    '(-e)-E[disable execution of commands from server]' \
+    '-g[disable use of GUI]' \
+    '-h:server host:_hosts' \
+    '-i:file pattern:' \
+    '-k[keep temporary copies of failed updates]' \
+    '-l:lock file:_files' \
+    '-L:verbosity level:(0 1 2)' \
+    '-p:port:_ports' \
+    '-P:connection mode:(m a port lo-hi -)' \
+    '-r:maximum number of retries:' \
+    '-s[suppress status checks]' \
+    '-v[print version information]' \
+    '(-Z)-z[enable compression]' \
+    '(-z)-Z[disable compression]' \
+    ':cvsup file:_files' \
+    ':destination directory:_files -/'
Index: Completion/Bsd/_kld
===================================================================
RCS file: _kld
diff -N _kld
--- /dev/null	Tue May  5 13:32:27 1998
+++ _kld	Thu Apr 20 02:42:24 2000
@@ -0,0 +1,41 @@
+#compdef kldload kldunload
+
+(( $+functions[_kld_module] )) ||
+_kld_module() {
+  local ret=1
+
+  compadd "$@" - /modules/*.ko(:t) && ret=0
+  _files "$@" -g \*.ko && ret=0
+
+  return ret
+}
+
+(( $+functions[_kld_unload] )) ||
+_kld_unload() {
+  compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $5 }' )
+}
+
+(( $+functions[_kld_unload_id] )) ||
+_kld_unload_id() {
+  compadd "$@" - $( /sbin/kldstat | awk '($1 ~ /^[0-9]/) { print $1 }' )
+}
+
+_kld() {
+  case "${words[1]:t}" in
+  kldload)
+    _arguments -s \
+        '-v[be verbose]' \
+        '*:module to load:_kld_module'
+    ;;
+
+  kldunload)
+    _arguments -s \
+        '-v[be verbose]' \
+        '(-n)-i:module id to unload:_kld_unload_id' \
+        '(-i)-n:module to unload:_kld_unload' \
+        '*:module to unload:_kld_unload'
+    ;;
+  esac
+}
+
+[[ -o kshautoload ]] || _kld "$@"

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author