[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Save more readline state when running compgen

From: Greg Wooledge
Subject: Re: [PATCH] Save more readline state when running compgen
Date: Tue, 21 Mar 2023 17:00:28 -0400

On Tue, Mar 21, 2023 at 04:52:03PM -0400, Grisha Levit wrote:
> On Tue, Mar 21, 2023 at 4:11 PM Chet Ramey <chet.ramey@case.edu> wrote:
> > OK, which do you think would be the more common case? Wanting the options
> > used to generate completions to persist or using it in this way?
> Usually people do `COMPREPLY=($(compgen ...))' (or write to stdout in
> a command specified with `complete -C') so nothing persists anyway,
> right?
> I don't know if there's really any use case that generates completions
> to place into COMPREPLY by running compgen in the foreground so it's
> hard for me to imagine a use case that benefits from the readline
> state being modified.

I don't use programmable completion, but I could *imagine* someone using
a temp file to store the results, then using mapfile to read them back
in, to avoid the fork() that the command substitution uses.  You'd
need a non-forking way to create the temp file, and to remove it, though,
or you'll lose all your gains in those steps.

I have no idea whether anyone actually does it that way in real life.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]