From e16bd69b1d7f347902110e29467681531af52694 Mon Sep 17 00:00:00 2001 From: taleksovska Date: Tue, 19 Mar 2024 09:40:47 +0100 Subject: [PATCH] Improve autocompletion functionality for 'enabler' command --- enabler/commands/enabler_completion.sh | 55 ++++++++++++++++++++ enabler/enabler_autocomplete.py | 70 -------------------------- 2 files changed, 55 insertions(+), 70 deletions(-) create mode 100755 enabler/commands/enabler_completion.sh delete mode 100755 enabler/enabler_autocomplete.py diff --git a/enabler/commands/enabler_completion.sh b/enabler/commands/enabler_completion.sh new file mode 100755 index 0000000..b761d59 --- /dev/null +++ b/enabler/commands/enabler_completion.sh @@ -0,0 +1,55 @@ +_enabler_complete() { + local cur_word prev_word commands + + # Get the current and previous words + cur_word="${COMP_WORDS[COMP_CWORD]}" + prev_word="${COMP_WORDS[COMP_CWORD-1]}" + local categories="apps kind preflight platform setup version" + + case "$prev_word" in + "enabler") # noqa + commands="$categories" + ;; + esac + + # Initialize the variable to store previous words + prev_words="" + local apps="namespace" + local kind="create delete status start stop" + local platform="init info keys release version" + local setup="init metallb istio" + + # Loop through previous words and concatenate them + for ((i=1; i