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

RE: GNU diff completion problem



>
> On Mar 9,  7:45pm, Andrej Borsenkow wrote:
> } Subject: GNU diff completion problem
> }
> } I'm sorry, but I missed this discussion.
> }
> } Why _diff_options tests diff and not real command ($word[1])?
>
> It's in case the real command is an alias or function that has unknown
> side-effects.
>

But this applies just as well to any other possible command that has GNU counterpart and
needs version check. What is so different with diff?

> } I have system default diff and GNU diff as gdiff. Current state does not
> } allow me to complete GNU diff at all
>
> You want
>
>     compdef _diff gdiff
>     zstyle ':completion:*:*:gdiff:*:version' command gdiff -v
>

Nope. I do want

compdef _diff diff gdiff

without bothering, if GNU diff is installed as main or additional program. The above will
cover 99.9% of installations.

I agree with the point, that _diff_options can be called in context without actual
command. But it simply means, that _diff_options should not test diff version itself, but
just get a "diff kind" parameter. Actual testing is to be done by _diff.

-andrej



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