Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion within a function
- X-seq: zsh-users 26267
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Ray Andrews <rayandrews@xxxxxxxxxxx>
- Subject: Re: completion within a function
- Date: Tue, 29 Dec 2020 13:48:19 -0800
- Archived-at: <https://zsh.org/users/26267>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-users/2020-12/CAH%2Bw%3D7bSbhdHGC89daK%2B8o0psLhdw969%3DGviC4s554t37_zrDw%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-ot1-f41.google.com) smtp.remote-ip=209.85.210.41; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none
- Cc: Zsh Users <zsh-users@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mkOFd+vsQoXxuSVgy+2DhmTP1QCDlXwusGrck53mu6o=; b=vq/pl2BTd++aXBLYwdByFHzBM3A1aVZ0yvTxSXcYjek1FPbuwl/yqY9dHaFAoZbzTs h0iTOZRox7SLboj4gxuTWUBs4zbsSQfrekjwfNvNalXhr3L+IUouELh+OWJMTRZNpn1E ReK3SmP6gXtdGplAsPY4ppg3KoKiA99zUZ8Gq0txZYq5ca+ZL+DA0ldJij2LLXhf3Hpm 9RmYuKUhfGAs1LJh+/1HVaRZ7qPl12/PysPtOWfQ49W67mdmd4q7U1qeOB21xltyuX/t AX02AxTTb2fcJOe/wjIjO0J9+gFwvQVQjgxJ78dsd6ijokinVMTDo0Mrt0Zpof2lbpZJ YhLA==
- In-reply-to: <819ec6fe-5af2-2e97-c5bb-f434b1de86d7@eastlink.ca>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-users>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-users.zsh.org>
- List-owner: <mailto:zsh-users-request@zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-users>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-users>
- References: <c9416d92-29b1-68e5-e51e-d7152f1fbc4b@eastlink.ca> <CAH+w=7bT5GaGvWih=A8KCyUe4N6k25VxDLcpPA5C1yGn38Zimg@mail.gmail.com> <819ec6fe-5af2-2e97-c5bb-f434b1de86d7@eastlink.ca>
- Sender: zsh-users-request@xxxxxxx
On Tue, Dec 29, 2020 at 1:04 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> func ()
> {
> code
> cd $1 [TAB]
> code
> code
> }
>
> ... so that I can automatically execute a completion within a function.
Where does the TAB come from?
I think what you're actually asking is how to apply the contextual
completion "rules" defined for a command ("cd" in this case) to a
parameter expansion. There really is not any way to do that
"automatically" because completion is tightly bound to having the ZLE
line editor active. It could be done the way that the test suite
emulates completion, but that's exceptionally convoluted, especially
error handling.
> 'vared' is a variable editor no? Does it do more than I think?
If you were to write
func()
{
code
vared 1
cd $1
code
code
}
Then at the point vared is invoked, func would pause, wait for the
user to press TAB or whatever, and then after accept-line is executed,
continue with whatever result.
Yes, you actually can vared the positional parameters.
More in response to the next message.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author