mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-02-26 00:09:11 +00:00
rewrite version func
This commit is contained in:
parent
5057029267
commit
229bc4a15f
@ -79,14 +79,15 @@ func main() {
|
|||||||
}),
|
}),
|
||||||
kong.Vars{
|
kong.Vars{
|
||||||
"version": func() string {
|
"version": func() string {
|
||||||
if version == "" {
|
if version != "" {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
info, ok := debug.ReadBuildInfo()
|
info, ok := debug.ReadBuildInfo()
|
||||||
if !ok {
|
if !ok {
|
||||||
return "(unable to read build info)"
|
return "(unable to read version)"
|
||||||
}
|
}
|
||||||
version = strings.Split(info.Main.Version, "-")[0]
|
return strings.Split(info.Main.Version, "-")[0]
|
||||||
}
|
|
||||||
return version
|
|
||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@ -77,14 +77,15 @@ func main() {
|
|||||||
}),
|
}),
|
||||||
kong.Vars{
|
kong.Vars{
|
||||||
"version": func() string {
|
"version": func() string {
|
||||||
if version == "" {
|
if version != "" {
|
||||||
|
return version
|
||||||
|
}
|
||||||
|
|
||||||
info, ok := debug.ReadBuildInfo()
|
info, ok := debug.ReadBuildInfo()
|
||||||
if !ok {
|
if !ok {
|
||||||
return "(unable to read build info)"
|
return "(unable to read version)"
|
||||||
}
|
}
|
||||||
version = strings.Split(info.Main.Version, "-")[0]
|
return strings.Split(info.Main.Version, "-")[0]
|
||||||
}
|
|
||||||
return version
|
|
||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user