Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: cvs-like file completion
- X-seq: zsh-users 11545
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: cvs-like file completion
- Date: Tue, 12 Jun 2007 14:36:17 +0200
- In-reply-to: <20070612121824.GA2770@xxxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070612121824.GA2770@xxxxxxxxxxxxxxxxxx>
Chris Johnson <cjohnson@xxxxxxxxxx>:
> Hi. Anyone familiar with the intimacies of completion know how I could
> make completion work like it does after "cvs add", but for a custom
> shell script?
>
> That is, I want to complete for a script cvsvimdiff all files that need
> committing to the cvs repository. Something like:
>
> compdef cvsvimdiff="cvs add"
>
> This isn't legal, of course, but that's the idea.
If the cvs completion function file _cvs is already loaded (and not
only marked for autoloading by compinit), you could do:
% compdef _cvs_files_unmaintained cvsvimdiff
That means, if you didn't use '_cvs' completion yet, you will get:
(eval):1: command not found: _cvs_files_unmaintained
To cure this, use '_cvs' by doing '_cvs add <TAB>', or source the
'_cvs' file by hand (and ignore the error message):
[snip]
% source /usr/share/zsh/4.3.4/functions/Completion/Unix/_cvs
_arguments:comparguments:303: can only be called from completion function
[snap]
Note, that AFAICS this only works, because '_cvs' creates a function,
that is dedicated to the task of finding uncommited files. For other
commands, this idea might not work.
Regards, Frank
PS: I don't know if there are better solutions for this problem. :-)
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author