From f2a1910c42d2cc5cf6ded331f4e00dc9a1205056 Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 26 Dec 2024 11:10:30 +0100 Subject: [PATCH] zsh: slice words to current --- example/cmd/_test/zsh.sh | 1 + internal/shell/zsh/snippet.go | 1 + 2 files changed, 2 insertions(+) diff --git a/example/cmd/_test/zsh.sh b/example/cmd/_test/zsh.sh index f3e3375af..44b6ce66d 100644 --- a/example/cmd/_test/zsh.sh +++ b/example/cmd/_test/zsh.sh @@ -1,6 +1,7 @@ #compdef example function _example_completion { local IFS=$'\n' + local words=${words[@]:0:$CURRENT} # shellcheck disable=SC2086,SC2154,SC2155 if echo ${words}"''" | xargs echo 2>/dev/null > /dev/null; then diff --git a/internal/shell/zsh/snippet.go b/internal/shell/zsh/snippet.go index c2bc0e309..4430febdc 100644 --- a/internal/shell/zsh/snippet.go +++ b/internal/shell/zsh/snippet.go @@ -13,6 +13,7 @@ func Snippet(cmd *cobra.Command) string { return fmt.Sprintf(`#compdef %v function _%v_completion { local IFS=$'\n' + local words=${words[@]:0:$CURRENT} # shellcheck disable=SC2086,SC2154,SC2155 if echo ${words}"''" | xargs echo 2>/dev/null > /dev/null; then