[cmake-developers] bash-completion and "<" ">" character

Eric Noulard eric.noulard at gmail.com
Thu Sep 26 09:42:09 EDT 2013


Switching thread of discussion.

2013/9/25 Matthew Woehlke <matthew.woehlke at kitware.com>:
> 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.

Yes this is the case if you type 'enter'
but if you type 'tab' then completion code is invoked

> 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.

This is not the case in the first place because bash completion
already knows that you are in "--help-variable" case.

> 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?

Nope, I will.

>>> 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?

I typed "<L" and then hit tab.

> If the former, does completion work better if you instead try to complete:
>
>
> $ cmake --help-variable CMAKE_\<L

Yes and no.
Asking for completion of hte previous I get
$ cmake --help-variable CMAKE_\<L
     first <tab> $ cmake --help-variable CMAKE_<LANG>_
second <tab> $ cmake --help-variable CMAKE_<LANG>CMAKE_<LANG>_

> 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?

I tried that with no success.
I will try to ask my question on bash-completion ML.

-- 
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org



More information about the cmake-developers mailing list