about summary refs log tree commit diff
path: root/Functions/Misc/run-help
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/run-help
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/run-help')
-rw-r--r--Functions/Misc/run-help19
1 files changed, 18 insertions, 1 deletions
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))