FS#67645 - [kustomize] Add Bash completion

Attached to Project: Community Packages
Opened by Asbjørn Apeland (aude) - Thursday, 20 August 2020, 08:11 GMT
Last edited by Christian Rebischke (Shibumi) - Saturday, 07 November 2020, 10:11 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Daurnimator (daurnimator)
Christian Rebischke (Shibumi)
Levente Polyak (anthraxx)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Would be nice to have Bash completion for the `kustomize` command.

Here's upstream docs for the Bash completion: https://github.com/kubernetes-sigs/kustomize/blob/0be4a61f64004300849fcc588eed168ce54b2581/cmd/config/docs/commands/completion.md

Their Bash completion is done through this library: https://github.com/posener/complete/tree/3627b9843923e3f366bb64a62d8adb0e6c469d83

Looked into the code of Kustomize and a bit of posener/complete, and it seemed to me that there is no easy way to extract the completion file itself. It just wants to install to ~/.bashrc itself.

Seems to me that an okay workaround is to run "kustomize install-completion" and copy-paste the generated completion files manually:

$ cat kustomize.completion.bash
complete -C /usr/bin/kustomize kustomize
$ cat kustomize.completion.zsh
autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/bin/kustomize kustomize
$ cat kustomize.completion.fish
function __complete_kustomize
set -lx COMP_LINE (commandline -cp)
test -z (commandline -ct)
and set COMP_LINE "$COMP_LINE "
/usr/bin/kustomize
end
complete -f -c kustomize -a "(__complete_kustomize)"
$ cat PKGBUILD | tail -n8
package(){
cd "kustomize-kustomize-v${pkgver}/kustomize"

install -D kustomize "${pkgdir}/usr/bin/kustomize"
install -D kustomize.completions.bash "${pkgdir}/usr/share/bash-completion/completions/kustomize"
install -D kustomize.completions.zsh "${pkgdir}/usr/share/zsh/site-functions/_kustomize"
install -D kustomize.completions.fish "${pkgdir}/usr/share/fish/vendor_completions.d/kustomize.fish"
}

What do you think?

Additional info:

* kustomize-3.8.1-1-x86_64

Steps to reproduce:

$ kustomize bu<TAB><TAB><TAB><TAB><TAB><TAB>
This task depends upon

Closed by  Christian Rebischke (Shibumi)
Saturday, 07 November 2020, 10:11 GMT
Reason for closing:  Fixed
Additional comments about closing:  kustomize-3.8.6-2

Loading...