tessia-cli-completion: add more advanced cli completion script

Extend click autocomplete feature

The new tessia-cli-completion.sh script utilizes the auto completion feature of the python click framework. In addition to the raw options it allows us to complete option values too. We generate the click autocomplete functions but we do not call the _tess_completion(s)etup() function. We then overwrite _tess_completion() and call _tess_completion(s)etup(). With this method we do not handle the subcommands and option autocompletion that click already handles for us.

** Autocomplete value caching**

To show values for some of the options in time I had to implement a chaching mechanism. Therefore data is fetched in background and the data may not be up to date at the time autocomplete is triggered. But as we do not update our data all the time it shouldn't be an issue. The result of the request is cached in the ~/.tessia-cli/bash-completion" folder. With this method we can at least show the data immediatelty the next time it is required.

Signed-off-by: André Wild andre.wild3@ibm.com

Merge request reports

Loading