Skip to content

Commit a411ae4

Browse files
authored
fix: Mac autocompletions (#14)
On Mac sometimes the completions failed due to the completions system not being active when chef-cli completions are added. This adds a check that starts the completions system if not yet started. https://app.devrev.ai/devrev/works/ISS-183252
1 parent d19affd commit a411ae4

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

autocomplete/zsh_autocomplete

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
#compdef chef-cli
44

5+
# Initialize completion system if needed
6+
if (( ! $+functions[compinit] )); then
7+
autoload -U compinit
8+
compinit
9+
fi
10+
511
_cli_zsh_autocomplete() {
612
local -a opts
713
local cur
@@ -19,4 +25,5 @@ _cli_zsh_autocomplete() {
1925
fi
2026
}
2127

28+
# Register the completion function
2229
compdef _cli_zsh_autocomplete chef-cli

0 commit comments

Comments
 (0)