rewrite version func

This commit is contained in:
onyx-and-iris 2026-02-16 01:25:07 +00:00
parent 1614194cbd
commit 626600e32a

15
main.go
View File

@ -116,14 +116,15 @@ func main() {
}), }),
kong.Vars{ kong.Vars{
"version": func() string { "version": func() string {
if version == "" { if version != "" {
info, ok := debug.ReadBuildInfo() return version
if !ok {
return "(unable to read build info)"
}
version = strings.Split(info.Main.Version, "-")[0]
} }
return version
info, ok := debug.ReadBuildInfo()
if !ok {
return "(unable to read version)"
}
return strings.Split(info.Main.Version, "-")[0]
}(), }(),
}, },
) )