about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2007-12-31 22:13:46 +0000
committerBart Schaefer <barts@users.sourceforge.net>2007-12-31 22:13:46 +0000
commit66742c60451a1741688245d682471611f33372a5 (patch)
tree32f8baf32cbf505f89ed3d35de02104d7287c547
parentf77eaddddf539497a77ffa019507530c1bcb50fb (diff)
downloadzsh-66742c60451a1741688245d682471611f33372a5.tar.gz
zsh-66742c60451a1741688245d682471611f33372a5.tar.xz
zsh-66742c60451a1741688245d682471611f33372a5.zip
24332, 24333: Improvements to run-help suggested by J.Sommer.
-rw-r--r--ChangeLog11
-rw-r--r--Functions/Misc/.distfiles25
-rw-r--r--Functions/Misc/run-help19
-rw-r--r--Functions/Misc/run-help-git10
-rw-r--r--Functions/Misc/run-help-svk1
-rw-r--r--Functions/Misc/run-help-svn1
6 files changed, 63 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index e2aff2e65..4313a3862 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-12-31  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* J.Sommer: 24333: Functions/Misc/.distfiles,
+	Functions/Misc/run-help-git, Functions/Misc/run-help-svk,
+	Functions/Misc/run-help-svn: run-help helpers.
+
+	* 24332: Functions/Misc/run-help: use only the path tail of $1
+	when calling "man" et al.  Look for a helper function named
+	run-help-$1 to provide specific help for the command, before
+	falling back on "man".
+
 2007-12-31  Clint Adams  <clint@zsh.org>
 
 	* 24330: Completion/X/_xpdf: add some missing options from xpdf
diff --git a/Functions/Misc/.distfiles b/Functions/Misc/.distfiles
index edfe128ac..2d515035f 100644
--- a/Functions/Misc/.distfiles
+++ b/Functions/Misc/.distfiles
@@ -1,8 +1,27 @@
 DISTFILES_SRC='
 .distfiles
 add-zsh-hook
-allopt      getjobs       mere       relative   zcalc   zmv          zargs
-checkmail   harden        nslookup   run-help   zed     zrecompile
-colors      is-at-least   promptnl   tetris     zkbd    zstyle+
+allopt
+checkmail
+colors
+getjobs
+harden
+is-at-least
+mere
+nslookup
+promptnl
+relative
+run-help
+run-help-git
+run-help-svk
+run-help-svn
+tetris
+zargs
+zcalc
+zed
+zkbd
 zmathfuncdef
+zmv
+zrecompile
+zstyle+
 '
diff --git a/Functions/Misc/run-help b/Functions/Misc/run-help
index ec0334118..cfa67f652 100644
--- a/Functions/Misc/run-help
+++ b/Functions/Misc/run-help
@@ -85,7 +85,24 @@ do
 	man zshmisc
 	;;
     (*)
-	((! didman++)) && man $@
+	if ((! didman++))
+	then
+	    if whence "run-help-$1:t" >/dev/null
+	    then
+		local cmd_args
+		builtin getln cmd_args
+		builtin print -z "$cmd_args"
+		cmd_args=( ${(z)cmd_args} )
+		# Discard environment assignments, etc.
+		while [[ $cmd_args[1] != $1 ]]
+		do
+		    shift cmd_args
+		done
+		eval "run-help-$1:t ${(@)cmd_args[2,-1]}"
+	    else
+		man $@:t
+	    fi
+	fi
 	;;
     esac
     if ((i < $#places && ! didman))
diff --git a/Functions/Misc/run-help-git b/Functions/Misc/run-help-git
new file mode 100644
index 000000000..51c6e250c
--- /dev/null
+++ b/Functions/Misc/run-help-git
@@ -0,0 +1,10 @@
+#!/bin/zsh
+if [ $# -eq 0 ]; then
+    man git
+else
+    local al
+    if al=$(git config --get "alias.$1"); then
+        1=${al%% *}
+    fi
+    man git-$1
+fi
diff --git a/Functions/Misc/run-help-svk b/Functions/Misc/run-help-svk
new file mode 100644
index 000000000..92438a53f
--- /dev/null
+++ b/Functions/Misc/run-help-svk
@@ -0,0 +1 @@
+svk help ${${@:#-*}[1]} | ${=PAGER:-more}
diff --git a/Functions/Misc/run-help-svn b/Functions/Misc/run-help-svn
new file mode 100644
index 000000000..5d1068588
--- /dev/null
+++ b/Functions/Misc/run-help-svn
@@ -0,0 +1 @@
+svn help ${${@:#-*}[1]} | ${=PAGER:-more}