summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--complete.go (renamed from bash.new.go)0
-rw-r--r--shell.go (renamed from bash.Completion.go)28
2 files changed, 28 insertions, 0 deletions
diff --git a/bash.new.go b/complete.go
index dee60c5..dee60c5 100644
--- a/bash.new.go
+++ b/complete.go
diff --git a/bash.Completion.go b/shell.go
index e0eb965..212c935 100644
--- a/bash.Completion.go
+++ b/shell.go
@@ -73,3 +73,31 @@ func makeBashCompletionText2(argname string) string {
out += fmt.Sprintf("# copy and paste the above into your bash shell should work\n")
return out
}
+
+// zsh:
+/*
+#compdef forge
+
+# Zsh completion function for the 'forge' command.
+
+_forge_completions() {
+ local -a words
+ local -i CURRENT
+
+ # Zsh's equivalent of Bash's COMP_WORDS and COMP_CWORD
+ words=("${(@)words}")
+ CURRENT=$CURRENT
+
+ # Generate the completion suggestions by calling the forge command.
+ # The output is split into an array.
+ local -a suggestions
+ suggestions=("${(@f)$(forge --auto-complete "'${words[CURRENT]}'" "${words[@]}")}")
+
+ # Pass the suggestions to the Zsh completion system.
+ _describe 'completions' suggestions
+}
+
+# Register the function to be called for the 'forge' command.
+_forge_completions "$@"
+
+*/