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

Re: PATCH: _diff (new), _prcs (upgrade)



Alexandre Duret-Lutz wrote:

> ...
>
>  Sven> So the style would only be used to get the command (including: how it
>  Sven> should be invoked, i.e. with `command' or not) and any options the
>  Sven> user wants to give to it. If the style is not set we use some standard 
>  Sven> way, so we don't have to set up default styles for this.
> 
> This (your last sentence) assume that no option is used by default (like
> the call to ps in _pids).  This seems restrictive (but I don't have an
> example where options are needed by default, and where the user would want
> to change them).

Err, either I misunderstand you here, or... options the completion
function wants to give would be give to _call, as in the example for
diff I had in my last answer (`_call diff -- -v').

The only problem is that this means that such options will always be
combined with the ones a user might define in a style. I.e. there are
actually two types of options a completion function might give to a
command: those that *have* to be there to make it work in the way the
function needs it (like the -v for diff) and those the completion
functions *suggests* to use -- which may be overridden by a user's
style. Ideally, we should support both cases...

>  >> ...
>  >> 
>  >> Another point about the $+functions[<name>] test: what if I am writting a
>  >> completion function for a shell function? say I need to call it, how do I
>  >> do?
> 
>  Sven> Good point. Also testing $+commands and $+builtins might help here,
>  Sven> but could still be wrong. Hm, I just wanted to make this cleverer but
>  Sven> since the style would allow one to override it anyway, we should
>  Sven> probably just call it without any pre-command modifier in the default
>  Sven> case. Or let _call accept options like -c and -b to say that the
>  Sven> default should use `command' or `builtin'. 
> 
> Given I am writting a _call in a completion function, how do I decide
> whether I must use -[bc] or not?  We ne a rule here, that should be used
> consistently in the completion system (see the first paragraph for what I
> suggest). 
> 
> And if a rule is chosen, _call can apply it, and therefore -[bc] parameters
> may not be needed anymore.

I suggested that to enable completion functions to make it as you
described in 9453: if we are completing for the command, call it
without a `command', otherwise with it. And that can't be decided in
_call.


Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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