[katello-devel] Bash completion file

Tomas Strachota tstrachota at redhat.com
Tue Dec 4 08:58:16 UTC 2012


On 12/04/2012 08:34 AM, Miroslav Suchý wrote:
> On 12/03/2012 10:09 PM, Jason Rist wrote:
>> I thought we already had completion.
>
> But only to common arguments. Completation does not work for every
> option and is not regulary updated. This can allow us to set up regular
> synchronization.
> Nice work Eric. I will check it up.
>

As Mirek said. We have very simple pure bash completion and full 
completion in "katello shell" mode (python driven) [1].

Optcomplete seems to be nice and simple library. Every command/action in 
our cli has its own optparser instance. I guess that is the reason why 
it didn't work with the simplest settings the documentation describes. I 
briefly checked optcomplete and it seems to have support for such cases 
and it's possible to define subcommands and solve this issue [2].

On the other hand we already have the completion functionality in shell 
mode so maybe we could extract it from there, create a separate 
_katellocomplete script and use it as a bash completor for katello.

T.

[1] 
https://github.com/Katello/katello/blob/master/cli/src/katello/client/shell.py#L225
[2] 
https://hg.furius.ca/public/optcomplete/file/83bf43e3db27/lib/python/optcomplete.py#l191




More information about the katello-devel mailing list