Update go utils

This commit is contained in:
blallo 2024-02-06 18:04:36 +01:00
parent 3ff115320c
commit 26a96cbcd9
No known key found for this signature in database
GPG key ID: C530464EEDCF489A

View file

@ -325,14 +325,16 @@ fi
### colored and fuzzy go doc
if which bat > /dev/null; then
function _godoc() {
local PAGE_LANG=go
local GO_LANG=go
if echo $1|grep -q -E "^([a-zA-Z0-9/]+)$"; then
go doc ${@} | bat -p -l md
go doc ${@} | bat -p -l ${PAGE_LANG}
elif echo $1|grep -q -E "^[a-zA-Z0-9/]+\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
go doc ${@} | bat -p -l ${GO_LANG}
elif echo $1|grep -q -E "^([a-zA-Z0-9/._-]+)/.*\.[a-zA-Z0-9.]+$"; then
go doc ${@} | bat -p -l go
go doc ${@} | bat -p -l ${GO_LANG}
else
go doc ${@} | bat -p -l md
go doc ${@} | bat -p -l ${PAGE_LANG}
fi
}
else