zsh-workers
 help / color / mirror / code / Atom feed
* run-help: Support for svn and git
@ 2007-12-30 19:19 Jörg Sommer
  2007-12-31  4:02 ` Bart Schaefer
  0 siblings, 1 reply; 15+ messages in thread
From: Jörg Sommer @ 2007-12-30 19:19 UTC (permalink / raw)
  To: zsh-workers

Hi,

calling run-help for svn or git is often not very helpful. svn has no
real information in the manpage and the infos for git blubb are in
git-blubb (not git). So, run-help should pay attention to the subcommand
for git and should call svn help subcommand |pager. My proposal:

#v+
--- /usr/share/zsh-beta/functions/Misc/run-help	2007-12-26 00:58:01.000000000 +0100
+++ /tmp/run-help	2007-12-30 20:18:37.530179261 +0100
@@ -12,8 +12,37 @@
 
 : ${HELPDIR:=/usr/share/zsh-beta/help}
 
-[[ $1 == "." ]] && 1="dot"
-[[ $1 == ":" ]] && 1="colon"
+local subcmd
+subcmd=
+
+case $1 in
+  (.) 1=dot;;
+  (:) 1=colon;;
+  (git|sv[kn])
+    local full_cmd
+    builtin getln full_cmd
+    builtin print -z "$full_cmd"
+    local i
+    for i in ${(z)full_cmd#*$1}; do      # remove VARIABLE=... $1
+        case "$i" in
+          (-*) ;;
+          (*)
+            case $1 in
+              (git)
+                if al=$(git config --get "alias.$i"); then
+                    1="git-${al%% *}"
+                else
+                    1="git-$i"
+                fi
+                ;;
+              (sv[kn]) subcmd=$i;;
+            esac
+            break
+            ;;
+        esac
+    done
+    ;;
+esac
 
 if [[ $# == 0 || $1 == "-l" ]]
 then
@@ -85,7 +114,11 @@
 	man zsh-betamisc
 	;;
     (*)
+        if [[ -n "${subcmd:-}" ]]; then
+            ((! didman++)) && $1 help $subcmd | ${=PAGER:-/usr/bin/pager}
+        else
 	((! didman++)) && man $@
+        fi
 	;;
     esac
     if ((i < $#places && ! didman))
#v-

Would you include this change?

Bye, Jörg.
-- 
Es liegt in der Natur des Menschen, vernünftig zu denken und
unlogisch zu handeln! Das Gesagte ist nicht das Gemeinte und das Gehörte
nicht das Verstandene!


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2008-01-13 19:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-30 19:19 run-help: Support for svn and git Jörg Sommer
2007-12-31  4:02 ` Bart Schaefer
2007-12-31 12:10   ` Jörg Sommer
2007-12-31 16:19     ` Bart Schaefer
2007-12-31 17:26       ` Jörg Sommer
2007-12-31 21:05         ` Bart Schaefer
2007-12-31 18:24   ` Jörg Sommer
2007-12-31 21:08     ` Bart Schaefer
2008-01-04  0:18       ` Clint Adams
2008-01-04  3:21         ` Bart Schaefer
2008-01-04  4:32           ` Clint Adams
2008-01-05 18:05             ` Bart Schaefer
2008-01-09 19:07               ` Clint Adams
2008-01-13 19:01                 ` Bart Schaefer
2008-01-04 12:13         ` Jörg Sommer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).