[Top][All Lists]

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

Re: Feature Request: Add option to make completed values always become p

From: Chet Ramey
Subject: Re: Feature Request: Add option to make completed values always become properly escaped
Date: Mon, 21 Feb 2022 11:32:34 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.6.0

On 2/20/22 1:40 PM, konsolebox wrote:
It's difficult to make values like 'release[remote]' to become
properly quoted or escaped because if the current word starts with a
quote (which can be a ', a ", or a $'), a manually quoted COMPREPLY
value like release\[remote\] will make the completed value include the
backslashes (e.g. 'release\[remote\]').  On the other hand if a
COMPREPLY value isn't escaped with backslashes, the result will be a
plain release[remote] (no backslash escapes) which results to
unintended globbing.  A possible workaround for this would be to check
if the current word is openly quoted before deciding if manually
quoting is needed or not.  And the only clean-and-close-to-accurate
way of doing it is to process the word against compgen -W and do
tests.  Manual parsing would be terrible.

If `complete` can have an option which forces all completed values to
be properly quoted, this manual quoting hacks wouldn't be needed.

What does `properly quoted' mean here and how does it differ from the
quoting you get when you force complete to treat the completions as
filenames with `complete -o filenames'?

``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]