aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula
diff options
context:
space:
mode:
authorJan Krutisch2011-01-25 15:36:02 +0100
committerAdam Vandenberg2011-06-07 07:52:41 -0700
commit98855b3e6eb967e9efd510c058d575e08b04c8bc (patch)
treeb8130f97b0998c6d8b60abbd732a84c62b38b789 /Library/Formula
parentbcdb3da1e4fff8bde2698e4fa7d474de510b262e (diff)
downloadhomebrew-98855b3e6eb967e9efd510c058d575e08b04c8bc.tar.bz2
cdargs: support zsh as well
It uses a patch that has been published on the cdargs website but for some reason never made it into the package. It keeps the script compatible with bash. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula')
-rw-r--r--Library/Formula/cdargs.rb56
1 files changed, 48 insertions, 8 deletions
diff --git a/Library/Formula/cdargs.rb b/Library/Formula/cdargs.rb
index 3a90cfcae..e35f83dac 100644
--- a/Library/Formula/cdargs.rb
+++ b/Library/Formula/cdargs.rb
@@ -7,6 +7,12 @@ class Cdargs < Formula
fails_with_llvm "Bus error in ld on SL 10.6.4"
+ # fixes zsh usage using the patch provided at the cdargs homepage
+ # (See http://www.skamphausen.de/cgi-bin/ska/CDargs)
+ def patches
+ DATA
+ end
+
def install
system "./configure", "--prefix=#{prefix}", "--mandir=#{man}"
system "make"
@@ -15,17 +21,51 @@ class Cdargs < Formula
rm Dir['contrib/Makefile*']
prefix.install 'contrib'
- bash_completion_dir = etc+'bash_completion.d'
- bash_completion_dir.mkpath
- ln_sf prefix+'contrib/cdargs-bash.sh', bash_completion_dir+'cdargs-bash.sh'
+ (etc+'bash_completion.d').mkpath
+ ln_sf prefix+'contrib/cdargs-bash.sh', etc+'bash_completion.d/cdargs-bash.sh'
end
- def caveats; <<-EOS
-Support files for bash, tcsh and emacs are located in #{prefix}/contrib.
-The file for bash is also symlinked to #{etc}/bash_completion.d/cdargs-bash.sh. Source it from
-your .bash_profile or .bashrc to get nice aliases and bash completion.
+ def caveats; <<-EOS.undent
+ Support files for bash, tcsh and emacs are located in:
+ #{prefix}/contrib
+
+ The file for bash is also symlinked to:
+ #{etc}/bash_completion.d/cdargs-bash.sh
+
+ Source it from your .bash_profile or .bashrc to get nice aliases and bash completion.
-Consult the cdargs man page for more details and instructions.
+ For zsh use the bash script.
+
+ Consult the cdargs man page for more details and instructions.
EOS
end
end
+
+
+__END__
+diff --git a/contrib/cdargs-bash.sh b/contrib/cdargs-bash.sh
+index 8a197ef..f3da067 100644
+--- a/contrib/cdargs-bash.sh
++++ b/contrib/cdargs-bash.sh
+@@ -11,6 +11,12 @@
+ 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 #
+@@ -166,7 +172,7 @@ 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";