From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15135 invoked from network); 31 Dec 2007 12:47:56 -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 12:47:56 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 89925 invoked from network); 31 Dec 2007 12:47:48 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 31 Dec 2007 12:47:48 -0000 Received: (qmail 21478 invoked by alias); 31 Dec 2007 12:47:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24329 Received: (qmail 21458 invoked from network); 31 Dec 2007 12:47:43 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 31 Dec 2007 12:47:43 -0000 Received: from virusfilter.dotsrc.org (bifrost [127.0.0.1]) by spamfilter.dotsrc.org (Postfix) with ESMTP id 8D8798058FA9 for ; Mon, 31 Dec 2007 13:47:42 +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 13:47:42 +0100 (CET) Received: by uucp.gnuu.de (Postfix, from userid 10) id 622C048803E; Mon, 31 Dec 2007 13:47:41 +0100 (CET) Received: from news by alea.gnuu.de with local (Exim 4.63) (envelope-from ) id 1J9JTW-00029Q-Lo for zsh-workers@sunsite.dk; Mon, 31 Dec 2007 13:10:34 +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 12:10:34 +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 1199103034 8270 192.168.0.5 (31 Dec 2007 12:10:34 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, Bart Schaefer wrote: > On Dec 30, 7:19pm, joerg@alea.gnuu.de wrote: > } > } calling run-help for svn or git is often not very helpful. > } > } Would you include this change? > > I don't think there's any reason to give git and/or svn any special > treatment ACK. > I also don't think it's the right approach to build special knowledge > into run-help of all possible commands that have subcommands. Yes, yours is a better approach. It's more generic. > Then one can do: > > run-help-svn () { > local cmd_args > cmd_args=( ${@:#-*} ) > svn help $cmd_args[1] I'm not very familiar with zsh programming. So this question might sound stupid, but why do you create a new variable? Why don't you use ${${@:#-*}[1]} ? Is it possible to get the point where run-help was called? Maybe for ssh -option <1> host cmd <2> run-help invoked at <1> opens the manpage of ssh and at <2> it opens the manpage of cmd. > Index: Functions/Misc/run-help > =================================================================== > diff -c -r1.3 run-help > --- Functions/Misc/run-help 30 May 2007 03:36:56 -0000 1.3 > +++ Functions/Misc/run-help 31 Dec 2007 02:51:44 -0000 > @@ -85,7 +85,20 @@ > man zshmisc > ;; > (*) > - ((! didman++)) && man $@ > + set -- $@:t > + if ((! didman++)) > + then > + if whence -w "run-help-$1" >/dev/null Why do you use -w, while you throw the output away. > + then > + local cmd_args > + builtin getln cmd_args > + builtin print -z "$cmd_args" > + cmd_args=( ${${(z)cmd_args}[2,-1]} ) > + eval "run-help-$1 $cmd_args[@]" Where do you remove the part before $1, e.g. LANG=bla? Why do you have to use eval? Doesn't run-help-$1 work? Bye, Jörg. -- Wer einen Traum verwirklichen will, muss erst aufwachen.