Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: run-help: Support for svn and git



Hi Bart,

Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Dec 30,  7:19pm, joerg@xxxxxxxxxxxx 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.



Messages sorted by: Reverse Date, Date, Thread, Author