zsh-workers
 help / color / mirror / code / Atom feed
From: "Jörg Sommer" <joerg@alea.gnuu.de>
To: zsh-workers@sunsite.dk
Subject: Re: run-help: Support for svn and git
Date: Mon, 31 Dec 2007 12:10:34 +0000 (UTC)	[thread overview]
Message-ID: <slrnfnhn1q.cgh.joerg@alea.gnuu.de> (raw)
In-Reply-To: <071230200204.ZM32486@torch.brasslantern.com>

Hi Bart,

Bart Schaefer <schaefer@brasslantern.com> 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.


  reply	other threads:[~2007-12-31 12:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-30 19:19 Jörg Sommer
2007-12-31  4:02 ` Bart Schaefer
2007-12-31 12:10   ` Jörg Sommer [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=slrnfnhn1q.cgh.joerg@alea.gnuu.de \
    --to=joerg@alea.gnuu.de \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).