From ef547aed25f914e31eee9b7e8f380270d34b6093 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Tue, 9 Jul 2024 16:16:36 +0200 Subject: [PATCH] fix: fix autocompletion (bash -> shell) --- cli/app/cmd.go | 5 +++-- scripts/autocomplete/bash | 4 ++-- scripts/autocomplete/fish | 2 +- scripts/autocomplete/powershell | 2 +- scripts/autocomplete/zsh | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cli/app/cmd.go b/cli/app/cmd.go index 2cf52779..53138c61 100644 --- a/cli/app/cmd.go +++ b/cli/app/cmd.go @@ -207,8 +207,9 @@ var appCmdListCommand = cli.Command{ internal.OfflineFlag, internal.ChaosFlag, }, - BashComplete: autocomplete.AppNameComplete, - Before: internal.SubCommandBefore, + EnableShellCompletion: true, + ShellComplete: autocomplete.AppNameComplete, + Before: internal.SubCommandBefore, Action: func(ctx context.Context, cmd *cli.Command) error { app := internal.ValidateApp(cmd) r := recipe.Get(app.Recipe.Name) diff --git a/scripts/autocomplete/bash b/scripts/autocomplete/bash index f0f62418..2c88b4f7 100755 --- a/scripts/autocomplete/bash +++ b/scripts/autocomplete/bash @@ -8,9 +8,9 @@ _cli_bash_autocomplete() { COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" if [[ "$cur" == "-"* ]]; then - opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion ) + opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-shell-completion ) else - opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) + opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-shell-completion ) fi COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 diff --git a/scripts/autocomplete/fish b/scripts/autocomplete/fish index 54427187..c40fae9d 100644 --- a/scripts/autocomplete/fish +++ b/scripts/autocomplete/fish @@ -1,5 +1,5 @@ function complete_abra_args - set -l cmd (commandline -poc) --generate-bash-completion + set -l cmd (commandline -poc) --generate-shell-completion $cmd end complete -c abra -f -n "not __fish_seen_subcommand_from -h --help -v --version complete_abra_args" -a "(complete_abra_args)" diff --git a/scripts/autocomplete/powershell b/scripts/autocomplete/powershell index cfffbf4f..6e0c422e 100644 --- a/scripts/autocomplete/powershell +++ b/scripts/autocomplete/powershell @@ -2,7 +2,7 @@ $fn = $($MyInvocation.MyCommand.Name) $name = $fn -replace "(.*)\.ps1$", '$1' Register-ArgumentCompleter -Native -CommandName $name -ScriptBlock { param($commandName, $wordToComplete, $cursorPosition) - $other = "$wordToComplete --generate-bash-completion" + $other = "$wordToComplete --generate-shell-completion" Invoke-Expression $other | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } diff --git a/scripts/autocomplete/zsh b/scripts/autocomplete/zsh index cf39c888..392946a3 100644 --- a/scripts/autocomplete/zsh +++ b/scripts/autocomplete/zsh @@ -6,9 +6,9 @@ _cli_zsh_autocomplete() { local cur cur=${words[-1]} if [[ "$cur" == "-"* ]]; then - opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}") + opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} ${cur} --generate-shell-completion)}") else - opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}") + opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-shell-completion)}") fi if [[ "${opts[1]}" != "" ]]; then