Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: No way to properly complete specific set of files
- X-seq: zsh-workers 31354
- From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: No way to properly complete specific set of files
- Date: Mon, 29 Apr 2013 00:39:11 -0500
- Cc: zsh-workers@xxxxxxx, Felipe Contreras Garza <felipe.contreras@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=e/JhWM6qQt2pW8Et/G4hSrUWG8975h+2I6nFQ9m0arQ=; b=AijF7OuWfVWPhNMrIunKIm5uwapp6jIlZSEUxa9ghJ1JIu3630+BzLZu7+iQr2vBYx TZw6ltrF1+yd6SJPKzrQwi9r1gMvgIuhTE10Hrfnjdz/5NAyjO+hmWZKwXBmFmz3Otvq LiFRDI7rYNJRiiM2WlVhtPI82m/3Y9npPl1td0AnfK+HYc1YbHT559Qeg1yAaFaPH8xY EWMEOqUYqcn68A1LxGeb13y444TjKArDXsUj+bD977aeTrhZcmsBlNcG8wBSzcPEzX+f k+B1kQCKiQZF8UqwOyiQq3GkTFwgJbZgrpU8xJKQJRJrud8qidJ+IoCJs8rykuAl1yD2 lPWQ==
- In-reply-to: <20130428191240.34181099@pws-pc.ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAMP44s1hjM94+o_xwaw=gsiwx1Y1rd12sqhunWywiTkWaJvTEQ@mail.gmail.com> <20130428191240.34181099@pws-pc.ntlworld.com>
On Sun, Apr 28, 2013 at 1:12 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Sat, 27 Apr 2013 05:12:27 -0500
> Felipe Contreras <felipe.contreras@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author