Merge pull request #1832 from cornfeedhobo/gocomplete
ensure go completion works well with goenvpull/1835/head
commit
133e48229a
|
|
@ -69,6 +69,7 @@ completion/available/docker.completion.bash
|
|||
completion/available/docker-machine.completion.bash
|
||||
completion/available/gcloud.completion.bash
|
||||
completion/available/gem.completion.bash
|
||||
completion/available/go.completion.bash
|
||||
completion/available/github-cli.completion.bash
|
||||
completion/available/helm.completion.bash
|
||||
completion/available/jungle.completion.bash
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
# shellcheck shell=bash
|
||||
about-completion "completion for go command using gocomplete"
|
||||
|
||||
# bash completion for go tool
|
||||
# https://github.com/posener/complete
|
||||
# https://pkg.go.dev/github.com/posener/complete?tab=doc
|
||||
|
||||
# Install gocomplete:
|
||||
# go get -u github.com/posener/complete/gocomplete
|
||||
# gocomplete -install
|
||||
|
||||
if _command_exists gocomplete && _command_exists go ; then
|
||||
complete -C "${GOBIN}"/gocomplete go
|
||||
# Test `go version` because goenv creates shim scripts that will be found in PATH
|
||||
# but do not always resolve to a working install.
|
||||
if _command_exists go && go version &> /dev/null; then
|
||||
# Same idea here, but no need to test a subcommand
|
||||
if _command_exists gocomplete && gocomplete &> /dev/null; then
|
||||
# finally, apply completion
|
||||
complete -C gocomplete go
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue