bug-bash
[Top][All Lists]
Advanced

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

Re: Custom word completion, word splitting, bad behavior


From: Chet Ramey
Subject: Re: Custom word completion, word splitting, bad behavior
Date: Wed, 7 Feb 2018 15:56:53 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

On 2/6/18 3:52 PM, Nick Patavalis wrote:
> Hi,
> 
> Thank you for your reply.
> 
> I'm not sure I understand everything, other than basically... "that's
> how readline does it".
> 
> I don't suggest there's a bug in readline, but I don't understand, for
> example, why
> 
>   foo --bar "baz" aa bb
> 
> is ok to be split like:
> 
>   foo | --bar | "baz" | aa | bb
> 
> while
> 
>   foo --bar="baz" aa bb
> 
> cannot be split like:
> 
>   foo | --bar | = | "baz" | aa | bb
> 
> What would be so terrible with this, that isn't with the previous
> (with regard to being able to complete inside quotes, and such)
> 
> In any case, splitting it like:
> 
>   foo | --bar | =" | baz" aa bb
> 
> (the last part a single word) does not look reasonable to me (even if
> it may be convenient in some occasions I cannot think of). It looks
> like a mix-up between the roles of " as a quoting character and as a
> word break character.

That may, in fact, be unreasonable. I'll take a look.

(It is not what I thought you were talking about as a problem: it seemed
to me that the `="' part was where you were objecting.)


> If I replace " with another word-break character (say :), the command
> is again split in a reasonable manner:
> 
>   foo | --bar | =: | baz | : | aa | bb
> 
> Actually, " behaves like a word-break character only when it's a part
> of a sequence of other word-break characters (from what I can
> tell). As, for example, in:
> 
>   foo bar"baz
>   foo | bar"baz    (and not: foo | bar | " | baz)
> 
> Anyway... confusing as it may be, it is as it is.
> 
> I guess my question is: how would you suggest I handle completion for
> a command, when an option is given like --bar="baz"? 

Are you trying to complete the option word?

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