chore: improve completion setup

This commit is contained in:
João Paulo Dubas 2024-06-16 12:24:54 +00:00
parent f9f0934339
commit aacef103a3

View File

@ -10,38 +10,23 @@ if [ ! -d ${LOCAL_SRC_HOME}/elixir-ls/release ]; then
fi fi
# NOTE: (jpd) create auto-completion # NOTE: (jpd) create auto-completion
# TODO: (jpd) check a way to create a list and loop to create these completions commands=(
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/kubectl.fish ]; then "ctlptl"
echo "setup kubectl completion" "eksctl"
kubectl completion fish > ${XDG_CONFIG_HOME}/fish/completions/kubectl.fish "helm"
fi "k3d"
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/kind.fish ]; then "k9s"
echo "setup kind completion" "kind"
kind completion fish > ${XDG_CONFIG_HOME}/fish/completions/kind.fish "kubectl"
fi "lefthook"
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/k3d.fish ]; then )
echo "setup k3d completion" echo "create completion for ${commands[@]}"
k3d completion fish > ${XDG_CONFIG_HOME}/fish/completions/k3d.fish for cmd in ${commands[@]}; do
fi completion_dir=${XDG_CONFIG_HOME}/fish/completions/${cmd}.fish
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/helm.fish ]; then if [ ! -f ${completion_dir} ]; then
echo "setup helm completion" echo "setup ${cmd} completion"
helm completion fish > ${XDG_CONFIG_HOME}/fish/completions/helm.fish echo $(${cmd} completion fish) > ${completion_dir}
fi
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/ctlptl.fish ]; then
echo "setup ctlptl completion"
ctlptl completion fish > ~/.config/fish/completions/ctlptl.fish
fi
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/eksctl.fish ]; then
echo "setup eksctl completion"
eksctl completion fish > ~/.config/fish/completions/eksctl.fish
fi
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/k9s.fish ]; then
echo "setup k9s completion"
k9s completion fish > ~/.config/fish/completions/k9s.fish
fi
if [ ! -d ${XDG_CONFIG_HOME}/fish/completions/lefthook.fish ]; then
echo "setup lefthook completion"
lefthook completion fish > ~/.config/fish/completions/lefthook.fish
fi fi
done
exec "$@" exec "$@"