[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: Chet Ramey
Subject: Re: [PATCH] Save more readline state when running compgen
Date: Tue, 21 Mar 2023 16:11:07 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 3/21/23 4:04 PM, Grisha Levit wrote:
On Tue, Mar 21, 2023 at 3:47 PM Chet Ramey <chet.ramey@case.edu> wrote:
OK, say you did in fact run compgen in the foreground -- very unusual
because it's awkward to capture the possible completions that way -- to
generate completions.

Sorry I should have explained. I hit this issue because I was using
compgen in an unorthodox way, just to check if some files matching a
glob exist. Basically something like

compgen -G 'foo/*' >/dev/null && COMPREPLY=(bar)

This can be a lot faster than expanding the glob into an array and
then testing that the array is not empty.

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?

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

reply via email to

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