[58310] trunk/dports/sysutils/bash-completion
raimue at macports.org
raimue at macports.org
Fri Sep 25 16:37:27 PDT 2009
Revision: 58310
http://trac.macports.org/changeset/58310
Author: raimue at macports.org
Date: 2009-09-25 16:37:23 -0700 (Fri, 25 Sep 2009)
Log Message:
-----------
sysutils/bash-completion:
Cleanup of description and renamed port completion file
Modified Paths:
--------------
trunk/dports/sysutils/bash-completion/Portfile
Added Paths:
-----------
trunk/dports/sysutils/bash-completion/files/port
Removed Paths:
-------------
trunk/dports/sysutils/bash-completion/files/port.cmd
Modified: trunk/dports/sysutils/bash-completion/Portfile
===================================================================
--- trunk/dports/sysutils/bash-completion/Portfile 2009-09-25 21:10:05 UTC (rev 58309)
+++ trunk/dports/sysutils/bash-completion/Portfile 2009-09-25 23:37:23 UTC (rev 58310)
@@ -9,9 +9,9 @@
categories sysutils
platforms darwin
maintainers raimue
-description Programmable bash{2,3} completions.
+description Programmable bash completions
long_description \
- Programmable completion library for bash
+ Programmable completion library for bash.
homepage http://bash-completion.alioth.debian.org/
master_sites http://bash-completion.alioth.debian.org/files/
@@ -28,7 +28,7 @@
xinstall -d ${destroot}${prefix}/etc/bash_completion.d
xinstall -m 755 ${worksrcpath}/bash_completion ${destroot}${prefix}/etc/
eval xinstall -m 644 [glob ${worksrcpath}/contrib/*] ${destroot}${prefix}/etc/bash_completion.d/
- xinstall -m 644 ${filespath}/port.cmd ${destroot}${prefix}/etc/bash_completion.d/port
+ xinstall -m 644 ${filespath}/port ${destroot}${prefix}/etc/bash_completion.d/port
}
destroot.keepdirs ${destroot}${prefix}/etc/
Copied: trunk/dports/sysutils/bash-completion/files/port (from rev 58309, trunk/dports/sysutils/bash-completion/files/port.cmd)
===================================================================
--- trunk/dports/sysutils/bash-completion/files/port (rev 0)
+++ trunk/dports/sysutils/bash-completion/files/port 2009-09-25 23:37:23 UTC (rev 58310)
@@ -0,0 +1,140 @@
+have port && {
+# helper functions for port completion
+#
+
+# port(1) completion
+#
+_port()
+{
+ local cur prev mode count portdir portdiropt i port
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ count=0
+ for i in ${COMP_WORDS[@]}; do
+ [ $count -eq $COMP_CWORD ] && break
+ # Last parameter was the portdir, now go back to mode selection
+ if [ "${COMP_WORDS[((count))]}" == "$portdir" -a "$mode" == "portdir" ]; then
+ mode=""
+ fi
+ if [ -z "$mode" ]; then
+ case $i in
+ -D)
+ mode=portdir
+ portdir=${COMP_WORDS[((count+1))]}
+ portdiropt="-D $portdir"
+ ;;
+ activate|archive|build|cat|cd|checksum|clean|compact|configure|\
+ contents|deactivate|dependents|deps|destroot|dir|distcheck|dmg|\
+ dpkg|echo|ed|edit|exit|extract|fetch|file|gohome|help|info|\
+ install|installed|lint|list|livecheck|load|location|mdmg|mirror|\
+ mpkg|outdated|patch|pkg|platform|provides|quit|rpm|search|selfupdate|\
+ srpm|submit|sync|test|trace|unarchive|uncompact|uninstall|unload|\
+ upgrade|url|usage|variants|version|work)
+ mode=$i
+ ;;
+ esac
+ elif [ -z "$port" ]; then
+ case $mode in
+ uninstall|upgrade|contents)
+ if [ $( port installed | awk ' !/The following ports/ {print $1}' \
+ | uniq | grep '^'$i'$') ]; then
+ port=$i
+ fi
+ ;;
+ *)
+ if [ $(port $portdiropt list | awk '{ print $1 }' | grep '^'$i'$') ]; then
+ port=$i
+ fi
+ ;;
+ esac
+ fi
+ count=$((++count))
+ done
+
+ if [ -n "$port" ]; then
+ # complete variants
+ case $mode in
+ contents|uninstall)
+ # installed variants
+ COMPREPLY=( $( port installed \
+ | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+ return 0
+ ;;
+ activate)
+ # inactive variants
+ COMPREPLY=( $( port installed | grep -v '(active)' \
+ | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+ return 0
+ ;;
+ deactivate)
+ # active variants
+ COMPREPLY=( $( port installed | grep '(active)' \
+ | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
+ COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
+ return 0
+ ;;
+ *)
+ # all variants
+ COMPREPLY=( $(port $portdiropt variants $port | tr '\r' ' ' | grep -v "has no variants") )
+ COMPREPLY=( $( compgen -P'+' -W '${COMPREPLY[@]}' -- $cur ) )
+ return 0
+ ;;
+ esac
+
+ fi
+
+ if [ -n "$mode" ]; then
+ # complete port names
+ case $mode in
+ uninstall|upgrade|contents)
+ # installed ports
+ COMPREPLY=( $( port installed \
+ | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
+ return 0
+ ;;
+ activate)
+ # inactive ports
+ COMPREPLY=( $( port installed | grep -v '(active)' \
+ | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
+ return 0
+ ;;
+ deactivate)
+ # active ports
+ COMPREPLY=( $( port installed | grep '(active)' \
+ | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
+ return 0
+ ;;
+ provides|portdir)
+ _filedir
+ return 0
+ ;;
+ installed|outdated|list|sync|selfupdate)
+ # no port
+ return 0
+ ;;
+ *)
+ # all ports
+ COMPREPLY=( $( port $portdiropt list \
+ | awk '/^'$cur'/ { print $1 }' | sort 2> /dev/null ) )
+ return 0
+ ;;
+ esac
+ fi
+
+ COMPREPLY=( $( compgen -W '-b -c -d -f -i -k -n -o -p -q -R -s -t -u -v -x \
+ activate archive build cat cd checksum clean compact configure \
+ contents deactivate dependents deps destroot dir distcheck dmg \
+ dpkg echo ed edit exit extract fetch file gohome help info \
+ install installed lint list livecheck load location mdmg mirror \
+ mpkg outdated patch pkg platform provides quit rpm search selfupdate \
+ srpm submit sync test trace unarchive uncompact uninstall unload \
+ upgrade url usage variants version work' -- $cur ) )
+ return 0
+}
+complete -F _port $filenames port
+}
Deleted: trunk/dports/sysutils/bash-completion/files/port.cmd
===================================================================
--- trunk/dports/sysutils/bash-completion/files/port.cmd 2009-09-25 21:10:05 UTC (rev 58309)
+++ trunk/dports/sysutils/bash-completion/files/port.cmd 2009-09-25 23:37:23 UTC (rev 58310)
@@ -1,140 +0,0 @@
-have port && {
-# helper functions for port completion
-#
-
-# port(1) completion
-#
-_port()
-{
- local cur prev mode count portdir portdiropt i port
-
- COMPREPLY=()
- cur=${COMP_WORDS[COMP_CWORD]}
- prev=${COMP_WORDS[COMP_CWORD-1]}
-
- count=0
- for i in ${COMP_WORDS[@]}; do
- [ $count -eq $COMP_CWORD ] && break
- # Last parameter was the portdir, now go back to mode selection
- if [ "${COMP_WORDS[((count))]}" == "$portdir" -a "$mode" == "portdir" ]; then
- mode=""
- fi
- if [ -z "$mode" ]; then
- case $i in
- -D)
- mode=portdir
- portdir=${COMP_WORDS[((count+1))]}
- portdiropt="-D $portdir"
- ;;
- activate|archive|build|cat|cd|checksum|clean|compact|configure|\
- contents|deactivate|dependents|deps|destroot|dir|distcheck|dmg|\
- dpkg|echo|ed|edit|exit|extract|fetch|file|gohome|help|info|\
- install|installed|lint|list|livecheck|load|location|mdmg|mirror|\
- mpkg|outdated|patch|pkg|platform|provides|quit|rpm|search|selfupdate|\
- srpm|submit|sync|test|trace|unarchive|uncompact|uninstall|unload|\
- upgrade|url|usage|variants|version|work)
- mode=$i
- ;;
- esac
- elif [ -z "$port" ]; then
- case $mode in
- uninstall|upgrade|contents)
- if [ $( port installed | awk ' !/The following ports/ {print $1}' \
- | uniq | grep '^'$i'$') ]; then
- port=$i
- fi
- ;;
- *)
- if [ $(port $portdiropt list | awk '{ print $1 }' | grep '^'$i'$') ]; then
- port=$i
- fi
- ;;
- esac
- fi
- count=$((++count))
- done
-
- if [ -n "$port" ]; then
- # complete variants
- case $mode in
- contents|uninstall)
- # installed variants
- COMPREPLY=( $( port installed \
- | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- return 0
- ;;
- activate)
- # inactive variants
- COMPREPLY=( $( port installed | grep -v '(active)' \
- | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- return 0
- ;;
- deactivate)
- # active variants
- COMPREPLY=( $( port installed | grep '(active)' \
- | awk '/'$port'/ { print $2 }' | tr '\r' ' ' 2> /dev/null ) )
- COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- $cur ) )
- return 0
- ;;
- *)
- # all variants
- COMPREPLY=( $(port $portdiropt variants $port | tr '\r' ' ' | grep -v "has no variants") )
- COMPREPLY=( $( compgen -P'+' -W '${COMPREPLY[@]}' -- $cur ) )
- return 0
- ;;
- esac
-
- fi
-
- if [ -n "$mode" ]; then
- # complete port names
- case $mode in
- uninstall|upgrade|contents)
- # installed ports
- COMPREPLY=( $( port installed \
- | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
- return 0
- ;;
- activate)
- # inactive ports
- COMPREPLY=( $( port installed | grep -v '(active)' \
- | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
- return 0
- ;;
- deactivate)
- # active ports
- COMPREPLY=( $( port installed | grep '(active)' \
- | sed -ne 's|^ \('$cur'[^ ]*\).*$|\1|p' | uniq ) )
- return 0
- ;;
- provides|portdir)
- _filedir
- return 0
- ;;
- installed|outdated|list|sync|selfupdate)
- # no port
- return 0
- ;;
- *)
- # all ports
- COMPREPLY=( $( port $portdiropt list \
- | awk '/^'$cur'/ { print $1 }' | sort 2> /dev/null ) )
- return 0
- ;;
- esac
- fi
-
- COMPREPLY=( $( compgen -W '-b -c -d -f -i -k -n -o -p -q -R -s -t -u -v -x \
- activate archive build cat cd checksum clean compact configure \
- contents deactivate dependents deps destroot dir distcheck dmg \
- dpkg echo ed edit exit extract fetch file gohome help info \
- install installed lint list livecheck load location mdmg mirror \
- mpkg outdated patch pkg platform provides quit rpm search selfupdate \
- srpm submit sync test trace unarchive uncompact uninstall unload \
- upgrade url usage variants version work' -- $cur ) )
- return 0
-}
-complete -F _port $filenames port
-}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090925/e1b348bb/attachment-0001.html>
More information about the macports-changes
mailing list