summary refs log tree commit diff
path: root/Functions/Misc
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 /Functions/Misc
parentf77eaddddf539497a77ffa019507530c1bcb50fb (diff)
downloadzsh-66742c60451a1741688245d682471611f33372a5.tar.gz
zsh-66742c60451a1741688245d682471611f33372a5.tar.xz
zsh-66742c60451a1741688245d682471611f33372a5.zip
24332, 24333: Improvements to run-help suggested by J.Sommer.
Diffstat (limited to 'Functions/Misc')
-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
5 files changed, 52 insertions, 4 deletions
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}