mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-02 19:53:23 +00:00
feat(wip): check if lua input is incomplete
This commit is contained in:
parent
0850247615
commit
9415c5193e
6
shell.go
6
shell.go
@ -8,6 +8,7 @@ import (
|
||||
|
||||
"github.com/bobappleyard/readline"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"github.com/yuin/gopher-lua/parse"
|
||||
"layeh.com/gopher-luar"
|
||||
"mvdan.cc/sh/v3/interp"
|
||||
"mvdan.cc/sh/v3/syntax"
|
||||
@ -31,6 +32,11 @@ func RunInput(input string) {
|
||||
fn, err := l.LoadString(cmdString)
|
||||
if err != nil && noexecute {
|
||||
fmt.Println(err)
|
||||
if lerr, ok := err.(*lua.ApiError); ok {
|
||||
if perr, ok := lerr.Cause.(*parse.Error); ok {
|
||||
print(perr.Pos.Line == parse.EOF)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
// And if there's no syntax errors and -n isnt provided, run
|
||||
|
Loading…
x
Reference in New Issue
Block a user