aboutsummaryrefslogtreecommitdiffstats
path: root/src/_golang
diff options
context:
space:
mode:
authorShohei YOSHIDA <syohex@gmail.com>2024-07-29 18:47:46 +0900
committerShohei YOSHIDA <syohex@gmail.com>2024-07-29 18:47:46 +0900
commitf475c1322f8f0e0b48cde56a42d93debe78f4fa9 (patch)
tree2b61663f1c8bd0b743accc5a988185f750e45e0c /src/_golang
parentUpdate 'go fix' completion (diff)
downloadzsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar.gz
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar.bz2
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar.lz
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar.xz
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.tar.zst
zsh-completions-f475c1322f8f0e0b48cde56a42d93debe78f4fa9.zip
Improve 'go help' completion
Diffstat (limited to 'src/_golang')
-rw-r--r--src/_golang42
1 files changed, 24 insertions, 18 deletions
diff --git a/src/_golang b/src/_golang
index 347576e..e3541d4 100644
--- a/src/_golang
+++ b/src/_golang
@@ -415,6 +415,17 @@ case $state in
'-json[prints the final go.mod/work file in JSON format]'
'-print[prints the final go.mod/work in its text format]'
)
+ local -a mod_commands=(
+ 'download:download modules to local cache'
+ 'edit:edit go.mod from tools or scripts'
+ 'graph:print module requirement graph'
+ 'init:initialize new module in current directory'
+ 'tidy:add missing and remove unused modules'
+ 'vendor:make vendored copy of dependencies'
+ 'verify:verify dependencies have expected content'
+ 'why:explain why packages or modules are needed'
+ 'help:get more information about a command'
+ )
case $words[1] in
build)
@@ -593,27 +604,15 @@ case $state in
_arguments ${list_args[@]}
;;
- mod)
- local -a mod_commands=(
- 'download:download modules to local cache'
- 'edit:edit go.mod from tools or scripts'
- 'graph:print module requirement graph'
- 'init:initialize new module in current directory'
- 'tidy:add missing and remove unused modules'
- 'vendor:make vendored copy of dependencies'
- 'verify:verify dependencies have expected content'
- 'why:explain why packages or modules are needed'
- 'help:get more information about a command'
- )
-
+ (mod)
_arguments \
"1: :{_describe 'command' mod_commands}" \
'*:: :->args'
case $state in
- args)
+ (args)
case $words[1] in
- download)
+ (download)
_arguments \
'-json[print a sequence of JSON objects to standard output]' \
'-x[print the commands download executes]'
@@ -662,12 +661,12 @@ case $state in
esac
;;
- run)
+ (run)
_arguments \
${build_flags[@]} \
'-exec[invoke the binary using xprog]:xporg' \
'*:importpaths:__go_packages'
- ;;
+ ;;
test)
if [[ $words[$CURRENT] = -test.* ]]; then
@@ -1129,7 +1128,14 @@ case $state in
'vcs:controlling version control with GOVCS'
)
- _arguments "1: :{_describe 'command' commands -- topics}"
+ case "$words[2]" in
+ (mod)
+ _arguments "2: :{_describe 'command' mod_commands}"
+ ;;
+ (*)
+ _arguments "1: :{_describe 'command' commands -- topics}"
+ ;;
+ esac
;;
esac
;;