mirror of https://github.com/Hilbis/Hilbish
fix: errors and make login rc run before config
parent
38f1d62598
commit
7f8d8db53e
13
lua.go
13
lua.go
|
@ -17,7 +17,7 @@ prompt(ansikit.format(
|
|||
))
|
||||
`
|
||||
|
||||
func LuaInit(confpath string) {
|
||||
func LuaInit() {
|
||||
l = lua.NewState()
|
||||
|
||||
l.OpenLibs()
|
||||
|
@ -66,12 +66,12 @@ func LuaInit(confpath string) {
|
|||
"Missing preload file, builtins may be missing.")
|
||||
}
|
||||
}
|
||||
|
||||
// Run config
|
||||
}
|
||||
func RunConfig(confpath string) {
|
||||
if !interactive {
|
||||
return
|
||||
}
|
||||
err = l.DoFile(confpath)
|
||||
err := l.DoFile(confpath)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err,
|
||||
"\nAn error has occured while loading your config! Falling back to minimal default config.\n")
|
||||
|
@ -84,7 +84,10 @@ func RunLogin() {
|
|||
if _, err := os.Stat(homedir + "/.hprofile.lua"); os.IsNotExist(err) {
|
||||
return
|
||||
}
|
||||
err = l.DoFile(homedir + "/.hprofile.lua")
|
||||
if !login {
|
||||
return
|
||||
}
|
||||
err := l.DoFile(homedir + "/.hprofile.lua")
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err,
|
||||
"\nAn error has occured while loading your login config!n")
|
||||
|
|
5
main.go
5
main.go
|
@ -61,7 +61,7 @@ func main() {
|
|||
}
|
||||
|
||||
// first arg, first character
|
||||
if loginshflag || os.Args[0][0] == "-" {
|
||||
if loginshflag || os.Args[0][0] == '-' {
|
||||
login = true
|
||||
}
|
||||
|
||||
|
@ -100,8 +100,9 @@ func main() {
|
|||
}
|
||||
|
||||
go HandleSignals()
|
||||
LuaInit(*configflag)
|
||||
LuaInit()
|
||||
RunLogin()
|
||||
RunConfig(*configflag)
|
||||
|
||||
readline.Completer = readline.FilenameCompleter
|
||||
readline.LoadHistory(homedir + "/.hilbish-history")
|
||||
|
|
Loading…
Reference in New Issue