feat: add hilbish.exitCode property (closes #101)

windows-fixes
TorchedSammy 2022-03-06 12:09:10 -04:00
parent 928b829388
commit 4b57dc2ed8
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
2 changed files with 2 additions and 0 deletions

1
api.go
View File

@ -65,6 +65,7 @@ The nice lil shell for {blue}Lua{reset} fanatics!
util.SetField(L, mod, "login", lua.LBool(interactive), "Whether this is a login shell")
util.SetField(L, mod, "greeting", lua.LString(greeting), "Hilbish's welcome message for interactive shells. It has Lunacolors formatting.")
util.SetField(l, mod, "vimMode", lua.LNil, "Current Vim mode of Hilbish (nil if not in Vim mode)")
util.SetField(l, hshMod, "exitCode", lua.LNumber(0), "Exit code of last exected command")
util.Document(L, mod, "Hilbish's core API, containing submodules and functions which relate to the shell itself.")
// hilbish.userDir table

View File

@ -244,5 +244,6 @@ func cmdFinish(code uint8, cmdstr, oldInput string) {
if !strings.HasPrefix(oldInput, " ") || interactive {
handleHistory(cmdstr)
}
util.SetField(l, hshMod, "exitCode", lua.LNumber(code), "Exit code of last exected command")
hooks.Em.Emit("command.exit", code, cmdstr)
}