[76597] trunk/dports/sysutils/cdargs

jmr at macports.org jmr at macports.org
Tue Mar 1 11:30:16 PST 2011


Revision: 76597
          http://trac.macports.org/changeset/76597
Author:   jmr at macports.org
Date:     2011-03-01 11:30:15 -0800 (Tue, 01 Mar 2011)
Log Message:
-----------
cdargs: add patch for zsh compatibility (#23239)

Modified Paths:
--------------
    trunk/dports/sysutils/cdargs/Portfile

Added Paths:
-----------
    trunk/dports/sysutils/cdargs/files/
    trunk/dports/sysutils/cdargs/files/patch-contrib-cdargs-bash.sh.diff

Modified: trunk/dports/sysutils/cdargs/Portfile
===================================================================
--- trunk/dports/sysutils/cdargs/Portfile	2011-03-01 19:19:25 UTC (rev 76596)
+++ trunk/dports/sysutils/cdargs/Portfile	2011-03-01 19:30:15 UTC (rev 76597)
@@ -4,6 +4,7 @@
 
 name            cdargs
 version         1.35
+revision        1
 categories      sysutils
 maintainers     entropy.ch:reg.macports
 description     Bookmarks for the shell
@@ -28,6 +29,8 @@
 
 configure.args  --mandir=${prefix}/share/man
 
+patchfiles      patch-contrib-cdargs-bash.sh.diff
+
 post-destroot {
     # Install helper files not installed by the Makefile
     xinstall -d ${destroot}${prefix}/etc/profile.d
@@ -41,7 +44,7 @@
     ui_msg "
 To use ${name}, you need to source it from your shell's startup file.
 
-If you're using bash, add these lines to your bash startup file:
+If you're using bash or zsh, add these lines to your bash startup file:
 
     if \[ -f ${prefix}/etc/profile.d/cdargs-bash.sh \]; then
         source ${prefix}/etc/profile.d/cdargs-bash.sh

Added: trunk/dports/sysutils/cdargs/files/patch-contrib-cdargs-bash.sh.diff
===================================================================
--- trunk/dports/sysutils/cdargs/files/patch-contrib-cdargs-bash.sh.diff	                        (rev 0)
+++ trunk/dports/sysutils/cdargs/files/patch-contrib-cdargs-bash.sh.diff	2011-03-01 19:30:15 UTC (rev 76597)
@@ -0,0 +1,68 @@
+--- contrib/cdargs-bash.sh.orig	2010-01-11 21:28:40.000000000 +0100
++++ contrib/cdargs-bash.sh	2010-01-11 21:31:05.000000000 +0100
+@@ -11,6 +11,13 @@
+ CDARGS_SORT=0   # set to 1 if you want mark to sort the list
+ CDARGS_NODUPS=1 # set to 1 if you want mark to delete dups
+ 
++# Support ZSH via its BASH completion emulation
++if [ -n "$ZSH_VERSION" ]; then
++    autoload bashcompinit
++    bashcompinit
++fi
++
++
+ # --------------------------------------------- #
+ # Run the cdargs program to get the target      #
+ # directory to be used in the various context   #
+@@ -142,8 +149,8 @@
+ # @access public                                #
+ # @return void                                  #
+ # --------------------------------------------- #
+-function cdb () 
+-{ 
++function cdb ()
++{
+     local dir
+ 
+     _cdargs_get_dir "$1" && cd "$dir" && echo `pwd`;
+@@ -161,25 +168,25 @@
+ # @access public                                #
+ # @return void                                  #
+ # --------------------------------------------- #
+-function mark () 
+-{ 
++function mark ()
++{
+     local tmpfile
+ 
+     # first clear any bookmarks with this same alias, if file exists
+-    if [[ "$CDARGS_NODUPS" && -e "$HOME/.cdargs" ]]; then
++    if [ "$CDARGS_NODUPS" ] && [ -e "$HOME/.cdargs" ]; then
+         tmpfile=`echo ${TEMP:-${TMPDIR:-/tmp}} | sed -e "s/\\/$//"`
+         tmpfile=$tmpfile/cdargs.$USER.$$.$RANDOM
+         grep -v "^$1 " "$HOME/.cdargs" > $tmpfile && 'mv' -f $tmpfile "$HOME/.cdargs";
+     fi
+     # add the alias to the list of bookmarks
+-    cdargs --add=":$1:`pwd`"; 
++    cdargs --add=":$1:`pwd`";
+     # sort the resulting list
+     if [ "$CDARGS_SORT" ]; then
+         sort -o "$HOME/.cdargs" "$HOME/.cdargs";
+     fi
+ }
+-# Oh, no! Not overwrite 'm' for stefan! This was 
+-# the very first alias I ever wrote in my un*x 
++# Oh, no! Not overwrite 'm' for stefan! This was
++# the very first alias I ever wrote in my un*x
+ # carreer and will always be aliased to less...
+ # alias m='mark'
+ 
+@@ -198,7 +205,7 @@
+ function ca ()
+ {
+     # add the alias to the list of bookmarks
+-    cdargs --add=":$1:`pwd`"; 
++    cdargs --add=":$1:`pwd`";
+ }
+ 
+ # --------------------------------------------- #
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110301/4b82490e/attachment-0001.html>


More information about the macports-changes mailing list