aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2009-09-15 08:23:19 +0000
committerDoug Barton <dougb@FreeBSD.org>2009-09-15 08:23:19 +0000
commite91dad25f9ce72d759e12b201b5ba2e240785b3e (patch)
tree7a0bb47eb28dd21fd25a968ce9b34b57fea65cfc /ports-mgmt
parent5979c0efa654626d06fdb435d8c0cf6a25c9fb8f (diff)
downloadports-e91dad25f9ce72d759e12b201b5ba2e240785b3e.tar.gz
ports-e91dad25f9ce72d759e12b201b5ba2e240785b3e.zip
Notes
Diffstat (limited to 'ports-mgmt')
-rw-r--r--ports-mgmt/portmaster/Makefile29
-rw-r--r--ports-mgmt/portmaster/files/bash-completions21
-rw-r--r--ports-mgmt/portmaster/files/zsh-completions68
3 files changed, 116 insertions, 2 deletions
diff --git a/ports-mgmt/portmaster/Makefile b/ports-mgmt/portmaster/Makefile
index 3028dc0fef4c..2749084609c8 100644
--- a/ports-mgmt/portmaster/Makefile
+++ b/ports-mgmt/portmaster/Makefile
@@ -8,7 +8,7 @@
#
PORTNAME= portmaster
-PORTVERSION= 2.11
+PORTVERSION= 2.12
CATEGORIES= ports-mgmt
MASTER_SITES= # none
DISTFILES= # none
@@ -16,6 +16,9 @@ DISTFILES= # none
MAINTAINER= dougb@FreeBSD.org
COMMENT= Manage your ports without external databases or languages
+OPTIONS= BASH "Install programmable completions for Bash" off \
+ ZSH "Install programmable completions for zsh" off
+
NO_BUILD= yes
SUB_FILES= portmaster.sh
@@ -23,8 +26,30 @@ PLIST_FILES= sbin/portmaster
MAN8= portmaster.8
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_BASH)
+PLIST_FILES+= share/portmaster/bash-completions
+PLIST_DIRS+= share/portmaster
+.endif
+
+.if defined(WITH_ZSH)
+PLIST_FILES+= share/zsh/site-functions/_portmaster
+.endif
+
do-install:
${INSTALL_SCRIPT} ${WRKDIR}/portmaster.sh ${PREFIX}/sbin/portmaster
${INSTALL_MAN} ${FILESDIR}/portmaster.8 ${MAN8PREFIX}/man/man8
-.include <bsd.port.mk>
+post-install:
+.if defined(WITH_BASH)
+ ${MKDIR} ${PREFIX}/share/portmaster
+ ${INSTALL_DATA} ${FILESDIR}/bash-completions ${PREFIX}/share/portmaster
+.endif
+.if defined(WITH_ZSH)
+ ${MKDIR} ${PREFIX}/share/zsh/site-functions
+ ${INSTALL_DATA} ${FILESDIR}/zsh-completions \
+ ${PREFIX}/share/zsh/site-functions/_portmaster
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/ports-mgmt/portmaster/files/bash-completions b/ports-mgmt/portmaster/files/bash-completions
new file mode 100644
index 000000000000..54af34c34c73
--- /dev/null
+++ b/ports-mgmt/portmaster/files/bash-completions
@@ -0,0 +1,21 @@
+_portmaster () {
+ local cur
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ case "$cur" in
+ /usr/ports/*)
+ COMPREPLY=( $( compgen -d $cur ) ) ;;
+ */*) COMPREPLY=( $( compgen -d /usr/ports/$cur ) ) ;;
+ --*) COMPREPLY=( $( compgen -W '--force-config --show-work \
+ --clean-distfiles --clean-distfiles-all --check-depends \
+ --check-port-dbdir --list-origins --help --version' -- $cur ) )
+ ;;
+ *) COMPREPLY=( $( compgen -d /var/db/pkg/$cur ) )
+ COMPREPLY=( ${COMPREPLY[@]#/var/db/pkg/} )
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d /usr/ports/$cur/ ) )
+ ;;
+ esac
+
+ return 0
+}
+complete -F _portmaster portmaster
diff --git a/ports-mgmt/portmaster/files/zsh-completions b/ports-mgmt/portmaster/files/zsh-completions
new file mode 100644
index 000000000000..e368c5cd1ed9
--- /dev/null
+++ b/ports-mgmt/portmaster/files/zsh-completions
@@ -0,0 +1,68 @@
+#compdef portmaster
+# For portmaster 2.11
+
+local context state line array ret=1
+typeset -A opt_args
+
+_arguments -A "-*" : \
+ "--force-config['make config' for all ports (must be first option)]" \
+ "-C[prevents 'make clean' from being run before building]" \
+ "(-F)-G[prevents recursive 'make config' (overrides --force-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[prevents creation of the backup package for the installed port]" \
+ "(-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-array]" \
+ "-v[verbose output]" \
+ "-w[save old shared libraries before deinstall]" \
+ "-u[DEPRECATED]" \
+ "-f[always rebuild ports (overrides -i)]" \
+ "(-f)-i[interactive update -- ask whether to rebuild ports]" \
+ "(-d)-D[no cleaning of distfiles]" \
+ "(-D)-d[always clean distfiles]" \
+ "-m[<arguments for the 'make' command line>]:arguments for make: " \
+ "-x[<avoid building or updating ports that match this pattern>]:glob pattern to exclude from building:->pkgs" \
+ "-p[specify the full path to a port directory]:port directory in /usr/ports:->ports" \
+ "--show-work[array what ports are and would be installed]" \
+ "-o[replace the installed port with a port from a different origin]:new port dir in /usr/ports:->ports" \
+ "-r[rebuild port, and all ports that depend on it]:name/glob of port in /var/db/pkg:->pkgs" \
+ "-R[used with -\[rf\] to skip ports updated on a previous run]" \
+ "-a[check all ports, update as necessary]" \
+ "-l[array installed ports by category]" \
+ "-L[array installed ports by category, and search for updates]" \
+ "-e[expunge a port via pkg_delete, and remove its distfiles]:name of port directory in /var/db/pkg:->pkgs" \
+ "-s[clean out stale ports that used to be depended on]" \
+ "(-G)-F[fetch distfiles only]" \
+ "--clean-distfiles[offer to delete stale distfiles]" \
+ "--clean-distfiles-all[delete stale distfiles without prompting]" \
+ "--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]" \
+ "(-h --help)"{-h,--help}"[display this help message]" \
+ "--version[display the version number]" \
+ '*:Packages and Ports:->pkgs_ports'
+
+case "$state" in
+ pkgs)
+ array=("${PKG_DBDIR:-/var/db/pkg}"/*(/:t))
+ _describe -t packages "installed ports" array
+ ;;
+ ports)
+ _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/
+ ;;
+ pkgs_ports)
+ _tags packages ports
+ while _tags; do
+ if _requested packages; then
+ array=("${PKG_DBDIR:-/var/db/pkg}"/*(/:t))
+ _describe -t packages "installed ports" array && ret=0
+ fi
+ if _requested ports; then
+ _files -X "%Bports%b" -W "${PORTSDIR:-/usr/ports}" -/ && ret=0
+ fi
+ (( ret )) || return ret
+ done
+ ;;
+esac