Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
run-help: Support for svn and git
- X-seq: zsh-workers 24327
- From: Jörg Sommer <joerg@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: run-help: Support for svn and git
- Date: Sun, 30 Dec 2007 19:19:49 +0000 (UTC)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxx>
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!
Messages sorted by:
Reverse Date,
Date,
Thread,
Author