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

Re: Issue with directory word completion



On Sun, Apr 21, 2013 at 1:44 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Apr 21,  6:22am, Felipe Contreras wrote:
> }
> } compadd -f -- 'Documents' 'Downloads/'
>
> You're not supposed to include a trailing slash on the compadd string.
> The completion system will figure that out on its own and append the
> slash if appropriate.  Note from the docs for -f:
>
>           ... all of the matches built from WORDS are
>           marked as being the names of files.  They are not required to
>           be actual filenames ...
>
> "Downloads/" is not an "actual filename" so it's marked as a file.  The
> "actual filename" of the directory is "Downloads".

Yeah, you are explaining the status quo, not why the status quo makes *sense*.

> I can already hear your objection, but what you're running into here is
> a division-of-labor decision:  the calling shell code is capable of doing
> the slash removal, and therefore it is left to it to do so rather than
> complicate the already fairly incomprehensible internals even further.

It would make sense to do so, but suit yourself.

-- 
Felipe Contreras



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