[cmake-developers] bash-completion: filtering out version line more robustly
Eric Noulard
eric.noulard at gmail.com
Wed Sep 25 15:50:14 EDT 2013
2013/9/25 Brad King <brad.king at kitware.com>:
> On 09/25/2013 12:18 PM, Eric Noulard wrote:
>> I think it would be simpler to use
>>
>> grep -v " "
>>
>> because help-*-list never contains a space (no variable or command
>> have embedded space)
>
> That's a much stronger assumption that is less future-proof.
ok.
> In the long run I don't want to do any filtering at all and just
> make sure the --help-*-list options display exactly what they should
> and nothing more. For now we need to tolerate existing CMake
> behavior with the most specific filter possible.
OK then the grep -v should be specific to cpack/cmake/ctest
because :
cpack --help-command-list
cpack version 2.8.11.20130925-g951a1
cpack_add_component
cpack_add_component_group
and
cmake --help-command-list
cmake version 2.8.11.20130925-g951a1
add_compile_options
so you should
grep -v "^cmake version " for cmake
grep -v "^cpack version " for cpack
grep -v "^ctest version " for ctest
>> I think you missed a couple of cases in the cmake completion.
>
> The only "tail" filters I left are in cache variable list output
> which is not filtering out the version line. A diff between mine
> and yours shows that you missed one in cpack:
>
> diff --git a/Docs/bash-completion/cpack b/Docs/bash-completion/cpack
> index e3f611e..6df0e41 100644
> --- a/Docs/bash-completion/cpack
> +++ b/Docs/bash-completion/cpack
> @@ -20,7 +20,7 @@ _cpack()
> -D)
> [[ $cur == *=* ]] && return # no completion for values
> COMPREPLY=( $( compgen -W '$( cpack --help-variable-list \
> - 2>/dev/null | grep -v "^cmake version " )' -S = -- "$cur" ) )
> + 2>/dev/null | tail -n +2 )' -S = -- "$cur" ) )
> compopt -o nospace
> return
> ;;
>
> Anyway, I still prefer my proposal. Please check that it works
> for you as I never actually use this myself.
ok, done with modification
grep -v "^cXXX version " for cXXX
and it works with current version printed and without it as well
(I did modify cmDocumentation.cxx for testing purpose as you suggested).
>> Sidenote along bash completion feature:
>>
>> completion of variables containing < > are not working that well
>
> If someone knows how to improve this I would welcome it but that
> is outside the scope of my change in question.
Understood.
--
Erk
L'élection n'est pas la démocratie -- http://www.le-message.org
More information about the cmake-developers
mailing list