From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16406 invoked from network); 31 Dec 2007 18:30:42 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 31 Dec 2007 18:30:42 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 34113 invoked from network); 31 Dec 2007 18:30:29 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Dec 2007 18:30:29 -0000 Received: (qmail 16671 invoked by alias); 31 Dec 2007 18:30:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24334 Received: (qmail 16635 invoked from network); 31 Dec 2007 18:30:19 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 31 Dec 2007 18:30:19 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id BAEED8058FB3 for ; Mon, 31 Dec 2007 19:30:15 +0100 (CET) Received: from uucp.gnuu.de (banki.eumelnet.de [83.246.114.63]) by bifrost.dotsrc.org (Postfix) with ESMTP for ; Mon, 31 Dec 2007 19:30:15 +0100 (CET) Received: by uucp.gnuu.de (Postfix, from userid 10) id F330848803F; Mon, 31 Dec 2007 19:30:13 +0100 (CET) Received: from news by alea.gnuu.de with local (Exim 4.63) (envelope-from ) id 1J9PJN-0002ZV-Jv for zsh-workers@sunsite.dk; Mon, 31 Dec 2007 19:24:29 +0100 To: zsh-workers@sunsite.dk Path: not-for-mail From: =?UTF-8?Q?J=C3=B6rg?= Sommer Newsgroups: local.mailinglist.zsh Subject: Re: run-help: Support for svn and git Date: Mon, 31 Dec 2007 18:24:29 +0000 (UTC) Message-ID: References: <071230200204.ZM32486@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: alea.gnuu.de 1199125469 9887 192.168.0.5 (31 Dec 2007 18:24:29 GMT) X-Complaints-To: usenet@alea.gnuu.de User-Agent: slrn/pre0.9.9-75 (Debian) Sender: news X-Virus-Scanned: ClamAV using ClamSMTP Hi, Bart Schaefer wrote: > Of course at this point we ought to add something to the manual (in the > contributions section, perhaps?) about the run-help function and its, > um, helpers. Is run-help really an alias, by default? At Debian it is the function from Functions/Misc. The first patch changes the text for the case the alias is not the default and the second one explains the new behaviour. --- contrib.yo+ 2007-12-31 18:41:54.000000000 +0100 +++ contrib.yo 2007-12-31 18:54:23.000000000 +0100 @@ -31,10 +31,10 @@ ifzman(zmanref(zshzle))\ ifnzman(noderef(Zsh Line Editor))\ ). This invokes the tt(run-help) command with the command word from the -current input line as its argument. By default, tt(run-help) is an alias -for the tt(man) command, so this often fails when the command word is a -shell builtin or a user-defined function. By redefining the tt(run-help) -alias, one can improve the on-line help provided by the shell. +current input line as its argument. tt(run-help) can simply be an alias +for the tt(man) command, but so this often fails when the command word is a +shell builtin or a user-defined function. By default, tt(run-help) +is an more intelligent function found in tt(Functions/Misc). The tt(helpfiles) utility, found in the tt(Util) directory of the distribution, is a Perl program that can be used to process the zsh manual @@ -61,23 +61,13 @@ Next, to use the tt(run-help) function, you need to add lines something like the following to your tt(.zshrc) or equivalent startup file: -example(unalias run-help -autoload run-help -HELPDIR=~/zsh_help) +example(HELPDIR=~/zsh_help) vindex(HELPDIR) The tt(HELPDIR) parameter tells tt(run-help) where to look for the help files. If your system already has a help file directory installed, set tt(HELPDIR) to the path of that directory instead. -Note that in order for `tt(autoload run-help)' to work, the tt(run-help) -file must be in one of the directories named in your tt(fpath) array (see -ifzman(zmanref(zshparam))\ -ifnzman(noderef(Parameters Used By The Shell))\ -). This should already be the case if you have a standard zsh -installation; if it is not, copy tt(Functions/Misc/run-help) to an -appropriate directory. - subsect(Recompiling Functions) cindex(functions, recompiling) cindex(zrecompile utility) diff -u contrib.yo contrib.yo --- contrib.yo 2007-12-31 18:54:23.000000000 +0100 +++ contrib.yo 2007-12-31 19:18:01.000000000 +0100 @@ -68,6 +68,40 @@ files. If your system already has a help file directory installed, set tt(HELPDIR) to the path of that directory instead. +If a command, alias or function tt(run-help-CMD) exists than tt(run-help) +executes this to get help for the command tt(CMD) and passes to it all +arguments of the command. This way you can define specialised functions +for some commands. Here are some examples: + +example(run-help-svn() +{ + svn help ${${@:#-*}[1]} | ${=PAGER:-/usr/bin/pager} +}) + +example(run-help-git() +{ + if [ $# -eq 0 ]; then + man git + else + local al + if al=$(git config --get "alias.$1"); then + 1=${al%% *} + fi + man git-$1 + fi +}) + +example(run-help-ssh() +{ + local args + args=(${@:#-*}) + if [ ${#args} -lt 2 ]; then + man ssh + else + run-help $args[2] + fi +}) + subsect(Recompiling Functions) cindex(functions, recompiling) cindex(zrecompile utility) Bye, Jörg. -- “Perl—the only language that looks the same before and after RSA encryption.” (Keith Bostic)