zsh-workers
 help / color / mirror / code / Atom feed
* an update patch for the _bsd_pkg compdef
@ 2002-02-01  6:12 Akinori MUSHA
  2002-02-01  6:13 ` Akinori MUSHA
  0 siblings, 1 reply; 2+ messages in thread
From: Akinori MUSHA @ 2002-02-01  6:12 UTC (permalink / raw)
  To: zsh-workers

Hi, 

Here's an update patch for the _bsd_pkg compdef, which includes a few
bug fixes and some wording fixes.  Please apply it also to the stable
branch so we can see it in the next release.

Regards,

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Somewhere out of a memory.. of lighted streets on quiet nights.."

Index: Completion/BSD/Command/_bsd_pkg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/BSD/Command/_bsd_pkg,v
retrieving revision 1.2
diff -u -r1.2 _bsd_pkg
--- Completion/BSD/Command/_bsd_pkg	2001/09/16 17:14:17	1.2
+++ Completion/BSD/Command/_bsd_pkg	2002/02/01 06:06:08
@@ -1,34 +1,41 @@
 #compdef pkg_add pkg_delete pkg_info
 
-(( $+functions[_bsd_pkg_packages] )) ||
-_bsd_pkg_packages() {
-  local ret=1 paths portsdir
+(( $+functions[_bsd_pkg_pkgfiles] )) ||
+_bsd_pkg_pkgfiles() {
+  local ret=1 paths portsdir pkgdir
 
   case $OSTYPE in
   netbsd*)
-    portsdir=/usr/pkg
+    portsdir=/usr/pkgsrc
     ;;
   *)
     portsdir=${PORTSDIR:-/usr/ports}
     ;;
   esac
 
+  pkgsdir=${PACKAGES:-$portsdir/packages}/All
+
   paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
   _files "$@" -g \*.tgz && ret=0
   (( $#path )) && _files "$@" -W paths -g \*.tgz && ret=0
-  compadd "$@" - $portsdir/packages/All/*.tgz && ret=0
+  compadd "$@" - $pkgsdir/*.tgz && ret=0
 
   return ret
 }
+
+(( $+functions[_bsd_pkg_pkgs] )) ||
+_bsd_pkg_pkgs() {
+  compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
+}
 
-(( $+functions[_bsd_pkg_or_file] )) ||
-_bsd_pkg_or_file() {
+(( $+functions[_bsd_pkg_pkgs_and_files] )) ||
+_bsd_pkg_pkgs_and_files() {
   local ret=1
 
   if (( $words[(I)-*F*] )); then
     _files "$@" && ret=0
   else
-    compadd "$@" - ${PKGDBDIR:-/var/db/pkg}/*(/:t) && ret=0
+    _bsd_pkg_pkgs "$@" && ret=0
   fi
 
   return ret
@@ -44,10 +51,10 @@
       '-I[don'\''t execute installation scripts]'
       '-M[run in master mode]'
       '-n[don'\''t really install packages]'
-      '-p:prefix directory:_files -/'
+      '-p[specify prefix]:prefix directory:_files -/'
       '-R[don'\''t record]'
       '-S[run in slave mode]'
-      '-t:mktemp template:_files -/'
+      '-t[specify mktemp template]:mktemp template:_files -/'
       '-v[be verbose]'
     )
 
@@ -55,7 +62,7 @@
     freebsd*)
       flags=(
         $flags[@]
-        '-r[use remote fetching]'
+        '-r[fetch from remote site]'
       )
       ;;
     netbsd*)
@@ -69,7 +76,7 @@
 
     _arguments -s \
       $flags[@] \
-      '*:package to install:_bsd_pkg_packages'
+      '*:package to install:_bsd_pkg_pkgfiles'
     ;;
 
   pkg_delete)
@@ -78,7 +85,7 @@
       '-d[remove empty directories]'
       '-f[force deinstallation]'
       '-n[don'\''t really deinstall packages]'
-      '-p:prefix directory:_files -/'
+      '-p[specify prefix]:prefix directory:_files -/'
       '-v[be verbose]'
     )
 
@@ -86,16 +93,17 @@
     freebsd*)
       flags=(
         $flags[@]
-	'(:)-a[show all installed packages]'
+	'(:)-a[delete all installed packages]'
         '-G[do not expand glob patterns]'
 	'-i[be interactive]'
+        '-r[delete recursively]'
         '-x[use regular expression]'
       )
       ;;
     netbsd*)
       flags=(
 	$flags[@]
-	'(:)-a[show all installed packages]'
+	'(:)-a[delete all installed packages]'
 	'-F[specify each package by an installed file]'
 	'-i[be interactive]'
 	'-O[only delete the package'\''s entries]'
@@ -108,7 +116,7 @@
 
     _arguments -s \
       $flags[@] \
-      '(-a)*:package name:_bsd_pkg_or_file'
+      '(-a)*:package name:_bsd_pkg_pkgs_and_files'
     ;;
 
   pkg_info)
@@ -117,13 +125,13 @@
       '-c[show comment fields]'
       '-D[show install-message files]'
       '-d[show long descriptions]'
-      '-e[test if package is installed]:package name:compadd - ${PKG_DBDIR:-/var/db/pkg}/*(\:t)'
+      '-e[test if package is installed]:package name:_bsd_pkg_pkgs'
       '-f[show packing list instructions]'
       '-I[show index lines]'
       '-i[show install scripts]'
       '-k[show deinstall scripts]'
       '-L[show full pathnames of files]'
-      '-l:prefix directory:_files -/'
+      '-l[specify prefix string]:prefix string:'
       '-m[show mtree files]'
       '-p[show installation prefixes]'
       '-q[be quiet]'
@@ -140,8 +148,8 @@
 	'-g[show files that'\''s modified]'
 	'-o[show origin]'
 	'-s[show total size occupied by each package]'
-	'-t:mktemp template:_files -/'
-	'*-W:show which package the file belongs to:_files'
+	'-t[specify mktemp template]:mktemp template:_files -/'
+	'*-W[show which package the file belongs to]:file:_files'
 	'-x[use regular expression]'
       )
       ;;
@@ -160,7 +168,7 @@
 
     _arguments -s \
       $flags[@] \
-      '(-a)*:package name:_bsd_pkg_or_file'
+      '(-a)*:package name:_bsd_pkg_pkgs_and_files'
     ;;
   esac
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: an update patch for the _bsd_pkg compdef
  2002-02-01  6:12 an update patch for the _bsd_pkg compdef Akinori MUSHA
@ 2002-02-01  6:13 ` Akinori MUSHA
  0 siblings, 0 replies; 2+ messages in thread
From: Akinori MUSHA @ 2002-02-01  6:13 UTC (permalink / raw)
  To: zsh-workers

Oops, I made a typo.

At Fri, 01 Feb 2002 15:12:27 +0900,
I wrote:
> +  local ret=1 paths portsdir pkgdir
+  local ret=1 paths portsdir pkgsdir
                                 ^

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Somewhere out of a memory.. of lighted streets on quiet nights.."


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-02-01  6:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-01  6:12 an update patch for the _bsd_pkg compdef Akinori MUSHA
2002-02-01  6:13 ` Akinori MUSHA

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).