about summary refs log tree commit diff
path: root/Completion/Bsd/_bsd_pkg
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-20 09:45:04 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-20 09:45:04 +0000
commit4debe47da511d78f9bee5d26926308e640b7bc9f (patch)
tree7064956c52f8b3db7aca03e5d906405a12e551bf /Completion/Bsd/_bsd_pkg
parentc9bedcd98923cd9890bd5d92ec5b0ada57bccc31 (diff)
downloadzsh-4debe47da511d78f9bee5d26926308e640b7bc9f.tar.gz
zsh-4debe47da511d78f9bee5d26926308e640b7bc9f.tar.xz
zsh-4debe47da511d78f9bee5d26926308e640b7bc9f.zip
new completions for FreeBSD commands (10861)
Diffstat (limited to 'Completion/Bsd/_bsd_pkg')
-rw-r--r--Completion/Bsd/_bsd_pkg68
1 files changed, 68 insertions, 0 deletions
diff --git a/Completion/Bsd/_bsd_pkg b/Completion/Bsd/_bsd_pkg
new file mode 100644
index 000000000..0cdfd9c1e
--- /dev/null
+++ b/Completion/Bsd/_bsd_pkg
@@ -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 "$@"