Skip to content

Commit 2c0c6b8

Browse files
authored
Merge pull request #3020 from carapace-sh/zsh-declare
zsh: use declare
2 parents 626faec + 2ab6719 commit 2c0c6b8

File tree

1 file changed

+9
-3
lines changed
  • cmd/carapace/cmd/lazyinit

1 file changed

+9
-3
lines changed

cmd/carapace/cmd/lazyinit/zsh.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ function _carapace_completer {
1717
local IFS=$'\n'
1818
local lines
1919
20+
declare -x CARAPACE_COMPLINE="${words}"
21+
declare -x CARAPACE_ZSH_HASH_DIRS="$(hash -d)"
22+
declare -x CARAPACE_SHELL=zsh
23+
declare -x CARAPACE_SHELL_BUILTINS="$(print -roC1 -- ${(k)builtins})"
24+
declare -x CARAPACE_SHELL_FUNCTIONS="$(print -l ${(ok)functions})"
25+
2026
# shellcheck disable=SC2086,SC2154,SC2155
21-
lines="$(echo "${compline}''" | CARAPACE_COMPLINE="${words}" CARAPACE_ZSH_HASH_DIRS="$(hash -d)" CARAPACE_SHELL=zsh CARAPACE_SHELL_BUILTINS="$(print -roC1 -- ${(k)builtins})" CARAPACE_SHELL_FUNCTIONS="$(print -l ${(ok)functions})" xargs carapace "${command}" zsh 2>/dev/null)"
27+
lines="$(echo "${compline}''" | xargs carapace "${command}" zsh 2>/dev/null)"
2228
if [ $? -eq 1 ]; then
23-
lines="$(echo "${compline}'" | CARAPACE_COMPLINE="${words}" CARAPACE_ZSH_HASH_DIRS="$(hash -d)" CARAPACE_SHELL=zsh CARAPACE_SHELL_BUILTINS="$(print -roC1 -- ${(k)builtins})" CARAPACE_SHELL_FUNCTIONS="$(print -l ${(ok)functions})" xargs carapace "${command}" zsh 2>/dev/null)"
29+
lines="$(echo "${compline}'" | xargs carapace "${command}" zsh 2>/dev/null)"
2430
if [ $? -eq 1 ]; then
25-
lines="$(echo "${compline}\"" | CARAPACE_COMPLINE="${words}" CARAPACE_ZSH_HASH_DIRS="$(hash -d)" CARAPACE_SHELL=zsh CARAPACE_SHELL_BUILTINS="$(print -roC1 -- ${(k)builtins})" CARAPACE_SHELL_FUNCTIONS="$(print -l ${(ok)functions})" xargs carapace "${command}" zsh 2>/dev/null)"
31+
lines="$(echo "${compline}\"" | xargs carapace "${command}" zsh 2>/dev/null)"
2632
fi
2733
fi
2834

0 commit comments

Comments
 (0)