[cmake-developers] bash-completion: filtering out version line more robustly

Matthew Woehlke matthew.woehlke at kitware.com
Wed Sep 25 16:25:26 EDT 2013


On 2013-09-25 16:14, Eric Noulard wrote:
> 2013/9/25 Matthew Woehlke <matthew.woehlke at kitware.com>:
>> On 2013-09-25 12:18, Eric Noulard wrote:
>>>
>>> $ cmake --help-variable CMAKE_<L
>>
>>
>> If you <tab> at the end of this line, aren't you trying to complete a local
>> file name 'L'?
>
> Yes and in fact it "restart" the completion, i.e. you get
> cmake --help-variable CMAKE_<CMAKE_L

That's odd...

Maybe I don't understand what context you are in.

If I type exactly what you showed at a bash prompt, then according to 
bash syntax (and verified by hitting 'enter' and receiving the expected 
error) 'L' is the name of a file which is redirected to cmake's stdin. 
Therefore, I would expect the completion context if one hits 'tab' 
having types exactly that to be 'L', in the context of a stdin redirection.

It sounds like you are seeing something different. I'm by no means a 
bash completion expert, but that seems odd. Maybe you should ask on the 
bash list if you haven't already?

>> Does it work if you escape the '<'?
>
> I don't really know how to do that inside a partial completion.
> The only option I see is to forcibly add a ' " 'prefix to the completion.

Again, maybe I am confused. Did *you* type the '<'? Or was the '<' 
emitted due to partial completion?

If the former, does completion work better if you instead try to complete:

$ cmake --help-variable CMAKE_\<L

If the latter... I'm not sure (see previous comment about not being a 
bash completion expert). Still, this works for e.g. file names, usually 
spaces are escaped automatically. I wonder if you were to simply do a 
replacement of '<' with '\<' in generated completions if it would work 
better?

-- 
Matthew




More information about the cmake-developers mailing list