zsh-workers
 help / color / mirror / code / Atom feed
* Issue with directory word completion
@ 2013-04-21 11:22 Felipe Contreras
  2013-04-21 11:22 ` Felipe Contreras
  2013-04-21 18:44 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Felipe Contreras @ 2013-04-21 11:22 UTC (permalink / raw)
  To: zsh-workers

Hi,

If I try the following:

compadd -f -- 'Documents' 'Downloads/'

Only one of them is properly detected as directory, the other one is
not, and when completed an extra space after the slash is added.

Why is the second one not detected as a directory?

-- 
Felipe Contreras


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with directory word completion
  2013-04-21 11:22 Issue with directory word completion Felipe Contreras
@ 2013-04-21 11:22 ` Felipe Contreras
  2013-04-21 18:44 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Felipe Contreras @ 2013-04-21 11:22 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras Garza

On Sun, Apr 21, 2013 at 6:22 AM, Felipe Contreras
<felipe.contreras@gmail.com> wrote:
> Hi,
>
> If I try the following:
>
> compadd -f -- 'Documents' 'Downloads/'
>
> Only one of them is properly detected as directory, the other one is
> not, and when completed an extra space after the slash is added.
>
> Why is the second one not detected as a directory?

Please keep the Cc.

-- 
Felipe Contreras


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with directory word completion
  2013-04-21 11:22 Issue with directory word completion Felipe Contreras
  2013-04-21 11:22 ` Felipe Contreras
@ 2013-04-21 18:44 ` Bart Schaefer
  2013-04-21 20:44   ` Felipe Contreras
  1 sibling, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2013-04-21 18:44 UTC (permalink / raw)
  To: Felipe Contreras, zsh-workers

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".

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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with directory word completion
  2013-04-21 18:44 ` Bart Schaefer
@ 2013-04-21 20:44   ` Felipe Contreras
  0 siblings, 0 replies; 4+ messages in thread
From: Felipe Contreras @ 2013-04-21 20:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers, Felipe Contreras Garza

On Sun, Apr 21, 2013 at 1:44 PM, Bart Schaefer
<schaefer@brasslantern.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-21 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-21 11:22 Issue with directory word completion Felipe Contreras
2013-04-21 11:22 ` Felipe Contreras
2013-04-21 18:44 ` Bart Schaefer
2013-04-21 20:44   ` Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).