feat: show go version hilbish was compiled with

comp-cache
sammyette 2023-07-10 21:56:35 -04:00
parent c6c81ddece
commit f540fc2c04
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 3 additions and 1 deletions

2
api.go
View File

@ -2,6 +2,7 @@
// The Hilbish module includes the core API, containing // The Hilbish module includes the core API, containing
// interfaces and functions which directly relate to shell functionality. // interfaces and functions which directly relate to shell functionality.
// #field ver The version of Hilbish // #field ver The version of Hilbish
// #field goVersion The version of Go that Hilbish was compiled with
// #field user Username of the user // #field user Username of the user
// #field host Hostname of the machine // #field host Hostname of the machine
// #field dataDir Directory for Hilbish data files, including the docs and default modules // #field dataDir Directory for Hilbish data files, including the docs and default modules
@ -110,6 +111,7 @@ func hilbishLoad(rtm *rt.Runtime) (rt.Value, func()) {
} }
util.SetFieldProtected(fakeMod, mod, "ver", rt.StringValue(getVersion())) util.SetFieldProtected(fakeMod, mod, "ver", rt.StringValue(getVersion()))
util.SetFieldProtected(fakeMod, mod, "goVersion", rt.StringValue(runtime.Version()))
util.SetFieldProtected(fakeMod, mod, "user", rt.StringValue(username)) util.SetFieldProtected(fakeMod, mod, "user", rt.StringValue(username))
util.SetFieldProtected(fakeMod, mod, "host", rt.StringValue(host)) util.SetFieldProtected(fakeMod, mod, "host", rt.StringValue(host))
util.SetFieldProtected(fakeMod, mod, "home", rt.StringValue(curuser.HomeDir)) util.SetFieldProtected(fakeMod, mod, "home", rt.StringValue(curuser.HomeDir))

View File

@ -106,7 +106,7 @@ func main() {
} }
if *verflag { if *verflag {
fmt.Printf("Hilbish %s\n", getVersion()) fmt.Printf("Hilbish %s\nCompiled with %s\n", getVersion(), runtime.Version())
os.Exit(0) os.Exit(0)
} }