2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-03 04:03:25 +00:00

fix: correct username in greeting on windows

This commit is contained in:
TorchedSammy 2022-03-16 18:42:38 -04:00
parent 32b421d402
commit 01d937afd8
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

10
api.go
View File

@ -48,15 +48,15 @@ func hilbishLoader(L *lua.LState) int {
host, _ := os.Hostname() host, _ := os.Hostname()
username := curuser.Username username := curuser.Username
greeting = `Welcome to {magenta}Hilbish{reset}, {cyan}` + curuser.Username + `{reset}.
The nice lil shell for {blue}Lua{reset} fanatics!
Check out the {blue}{bold}guide{reset} command to get started.
`
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
username = strings.Split(username, "\\")[1] // for some reason Username includes the hostname on windows username = strings.Split(username, "\\")[1] // for some reason Username includes the hostname on windows
} }
greeting = `Welcome to {magenta}Hilbish{reset}, {cyan}` + username + `{reset}.
The nice lil shell for {blue}Lua{reset} fanatics!
Check out the {blue}{bold}guide{reset} command to get started.
`
util.SetField(L, mod, "ver", lua.LString(version), "Hilbish version") util.SetField(L, mod, "ver", lua.LString(version), "Hilbish version")
util.SetField(L, mod, "user", lua.LString(username), "Username of user") util.SetField(L, mod, "user", lua.LString(username), "Username of user")
util.SetField(L, mod, "host", lua.LString(host), "Host name of the machine") util.SetField(L, mod, "host", lua.LString(host), "Host name of the machine")