zsh-workers
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh-workers@zsh.org, Felipe Contreras Garza <felipe.contreras@gmail.com>
Subject: Re: No way to properly complete specific set of files
Date: Mon, 29 Apr 2013 00:39:11 -0500	[thread overview]
Message-ID: <CAMP44s0Nz2K5JOvf5HwU=qr5d6UbotqVPeYHSZX=WcpNCf4uHw@mail.gmail.com> (raw)
In-Reply-To: <20130428191240.34181099@pws-pc.ntlworld.com>

On Sun, Apr 28, 2013 at 1:12 PM, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:
> On Sat, 27 Apr 2013 05:12:27 -0500
> Felipe Contreras <felipe.contreras@gmail.com> wrote:
>> I have an array, let's say:
>>
>>   files=('Documents' 'Downloads' 'Downloads/test' 'Videos')
>>
>> And I want to complete those files, with all the niceties that _file has.
>>...
>> Am I missing something?
>
> I don't think you're missing anything in the sense that there's anything
> really designed for this, no...  to follow up on something Bart noted
> earlier, the completion system is written in such a way that it doesn't
> provide a lot of support for things that aren't done the way the
> original author thought of.  It would be great to refactor it to be
> both more general and more maintainable, but alas there are way too few
> volunteers for that sort of exercise.
>
> However, you can trick it to some extent:
>
> _path_files -g "(${(j.|.)~files})"
>
> relying on an extended_glob pattern to match any of the files.  That's
> not perfect --- in particular if there are metacharacters in the
> file names they'll confuse it.  Further, I think you're going to have
> trouble with directories; you'd need to decide what the files were
> within the current directory path, so you can't do stuff like complete
> Downloads/test directly that way.  It's probably possible to work around
> --- factor out the path that's already been completed --- but a bit
> fiddly and not gaining a lot over what you're already doing.

Yeah, but the next question is; why didn't the author think of that?
It seems like fairly obvious to me that somebody eventually would come
up with that need, and it seems many have done so, and they are using
_multi_parts for that (e.g. _git and _hg), but doesn't work nicely
either.

Too bad.

Cheers.

-- 
Felipe Contreras


      parent reply	other threads:[~2013-04-29  5:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 10:12 Felipe Contreras
2013-04-28 18:12 ` Peter Stephenson
2013-04-28 23:42   ` Bart Schaefer
2013-04-29  5:39   ` Felipe Contreras [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMP44s0Nz2K5JOvf5HwU=qr5d6UbotqVPeYHSZX=WcpNCf4uHw@mail.gmail.com' \
    --to=felipe.contreras@gmail.com \
    --cc=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).