ports/127319: [PATCH] portmaster - add completion for zsh

Shota Iwazaki iwazaki8 at yahoo.co.jp
Fri Sep 12 12:00:03 UTC 2008


>Number:         127319
>Category:       ports
>Synopsis:       [PATCH] portmaster - add completion for zsh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Sep 12 12:00:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Shota Iwazaki
>Release:        8.0-CURRENT
>Organization:
>Environment:
FreeBSD truth.local 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Tue Sep  9 21:26:37 JST 2008     root at truth.local:/usr/obj/usr/src/sys/CUSTOM  amd64
>Description:
add completion code "_portmaster" for zsh.

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

diff -urN portmaster.orig/Makefile portmaster/Makefile
--- portmaster.orig/Makefile	2008-09-12 01:22:09.000000000 +0900
+++ portmaster/Makefile	2008-09-12 18:10:05.000000000 +0900
@@ -9,6 +9,7 @@
 
 PORTNAME=	portmaster
 PORTVERSION=	2.6
+PORTREVISION=	1
 CATEGORIES=	ports-mgmt
 MASTER_SITES=	# none
 DISTFILES=	# none
@@ -19,12 +20,14 @@
 NO_BUILD=	yes
 SUB_FILES=	portmaster.sh
 
-PLIST_FILES=	sbin/portmaster
+PLIST_FILES=	sbin/portmaster\
+				share/zsh/site-functions/_portmaster
 
 MAN8=		portmaster.8
 
 do-install:
 	${INSTALL_SCRIPT} ${WRKDIR}/portmaster.sh ${PREFIX}/sbin/portmaster
 	${INSTALL_MAN} ${FILESDIR}/portmaster.8 ${MAN8PREFIX}/man/man8
+	${INSTALL_DATA} ${FILESDIR}/_portmaster ${PREFIX}/share/zsh/site-functions
 
 .include <bsd.port.mk>
diff -urN portmaster.orig/files/_portmaster portmaster/files/_portmaster
--- portmaster.orig/files/_portmaster	1970-01-01 09:00:00.000000000 +0900
+++ portmaster/files/_portmaster	2008-09-12 20:31:16.000000000 +0900
@@ -0,0 +1,66 @@
+#compdef portmaster
+
+(( $+functions[_portmaster_pkgs] )) ||
+_portmaster_pkgs() {
+  compadd "$@" - ${PKG_DBDIR:-/var/db/pkg}/*(/:t)
+}
+
+(( $+functions[_portmaster_ports] )) ||
+_portmaster_ports() {
+  local ret=1
+
+  _files "$@" -W ${PORTSDIR:-/usr/ports} -/ && ret=0
+
+  return ret
+}
+
+(( $+functions[_portmaster_pkgs_and_ports] )) ||
+_portmaster_pkgs_and_ports() {
+  local ret=1
+
+  _portmaster_pkgs && ret=0
+  _portmaster_ports && ret=0
+
+  return ret
+}
+
+_portmaster() {
+  _arguments -A "-*" \
+    "(-G)--force-config[run 'make config' for all ports]" \
+    '(-b)-B[prevents creation of the backup package for the installed port]' \
+    "-C[prevents 'make clean' from being run before building]" \
+    "(--force-config)-G[prevents the recursive 'make config']" \
+    '-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]' \
+    '(-d)-D[no cleaning of distfiles]' \
+    '(-D)-d[always clean distfiles]' \
+    '-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]' \
+    '-o[replace the installed port with a port from a different origin]:<new port dir>:_portmaster_ports' \
+    '-r[rebuild the specified port, and all ports that depend on it]:name/glob of port:_portmaster_pkgs' \
+    '-R[restart an update, skipping ports already up to date]' \
+    '-a[check all ports, update as necessary]' \
+    '-l[list all installed ports by category]' \
+    '-L[list all installed ports by category, and search for updates]' \
+    '-e[expunge port using pkg_delete, and remove all distfiles]:name of port:_portmaster_pkgs' \
+    '-s[clean out stale ports that used to be depended on]' \
+    '-F[fetch distfiles only]' \
+    '--clean-distfiles[offer to delete stale files]' \
+    '--check-depends[cross-check and update dependency information for all ports]' \
+    '(-h --help)'{-h,--help}'[display help message]' \
+    '--version[display the version only]' \
+    '*:Packages and Ports:_portmaster_pkgs_and_ports'
+}
+
+_portmaster "$@"


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list