mirror of https://github.com/Hilbis/Hilbish
Compare commits
No commits in common. "e5c8e5eaffae28099c8b83db4fef501a899d23a4" and "7108523a4c7d4debdac7ae834c83520a9a66bda2" have entirely different histories.
e5c8e5eaff
...
7108523a4c
|
@ -145,9 +145,6 @@ menu is open.
|
||||||
- Escape codes now work.
|
- Escape codes now work.
|
||||||
- Escape percentage symbols in completion entries, so you will no longer see
|
- Escape percentage symbols in completion entries, so you will no longer see
|
||||||
an error of missing format variable
|
an error of missing format variable
|
||||||
- Fix an error with sh syntax in aliases
|
|
||||||
- Prompt now works with east asian characters (CJK)
|
|
||||||
- Set back the prompt to normal after exiting the continue prompt with ctrl-d
|
|
||||||
|
|
||||||
## [1.2.0] - 2022-03-17
|
## [1.2.0] - 2022-03-17
|
||||||
### Added
|
### Added
|
||||||
|
|
13
exec.go
13
exec.go
|
@ -96,23 +96,23 @@ func runInput(input string, priv bool) {
|
||||||
if currentRunner.Type() == rt.StringType {
|
if currentRunner.Type() == rt.StringType {
|
||||||
switch currentRunner.AsString() {
|
switch currentRunner.AsString() {
|
||||||
case "hybrid":
|
case "hybrid":
|
||||||
_, _, err = handleLua(input)
|
_, _, err = handleLua(cmdString)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cmdFinish(0, input, priv)
|
cmdFinish(0, input, priv)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
input, exitCode, cont, err = handleSh(input)
|
input, exitCode, cont, err = handleSh(cmdString)
|
||||||
case "hybridRev":
|
case "hybridRev":
|
||||||
_, _, _, err = handleSh(input)
|
_, _, _, err = handleSh(input)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
cmdFinish(0, input, priv)
|
cmdFinish(0, input, priv)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
input, exitCode, err = handleLua(input)
|
input, exitCode, err = handleLua(cmdString)
|
||||||
case "lua":
|
case "lua":
|
||||||
input, exitCode, err = handleLua(input)
|
input, exitCode, err = handleLua(cmdString)
|
||||||
case "sh":
|
case "sh":
|
||||||
input, exitCode, cont, err = handleSh(input)
|
input, exitCode, cont, err = handleSh(cmdString)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// can only be a string or function so
|
// can only be a string or function so
|
||||||
|
@ -195,8 +195,7 @@ func runLuaRunner(runr rt.Value, userInput string) (input string, exitCode uint8
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleLua(input string) (string, uint8, error) {
|
func handleLua(cmdString string) (string, uint8, error) {
|
||||||
cmdString := aliases.Resolve(input)
|
|
||||||
// First try to load input, essentially compiling to bytecode
|
// First try to load input, essentially compiling to bytecode
|
||||||
chunk, err := l.CompileAndLoadLuaChunk("", []byte(cmdString), rt.TableValue(l.GlobalEnv()))
|
chunk, err := l.CompileAndLoadLuaChunk("", []byte(cmdString), rt.TableValue(l.GlobalEnv()))
|
||||||
if err != nil && noexecute {
|
if err != nil && noexecute {
|
||||||
|
|
|
@ -28,13 +28,13 @@ func shRunner(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, exitCode, cont, err := execSh(aliases.Resolve(cmd))
|
input, exitCode, cont, err := execSh(cmd)
|
||||||
var luaErr rt.Value = rt.NilValue
|
var luaErr rt.Value = rt.NilValue
|
||||||
if err != nil {
|
if err != nil {
|
||||||
luaErr = rt.StringValue(err.Error())
|
luaErr = rt.StringValue(err.Error())
|
||||||
}
|
}
|
||||||
runnerRet := rt.NewTable()
|
runnerRet := rt.NewTable()
|
||||||
runnerRet.Set(rt.StringValue("input"), rt.StringValue(cmd))
|
runnerRet.Set(rt.StringValue("input"), rt.StringValue(input))
|
||||||
runnerRet.Set(rt.StringValue("exitCode"), rt.IntValue(int64(exitCode)))
|
runnerRet.Set(rt.StringValue("exitCode"), rt.IntValue(int64(exitCode)))
|
||||||
runnerRet.Set(rt.StringValue("continue"), rt.BoolValue(cont))
|
runnerRet.Set(rt.StringValue("continue"), rt.BoolValue(cont))
|
||||||
runnerRet.Set(rt.StringValue("err"), luaErr)
|
runnerRet.Set(rt.StringValue("err"), luaErr)
|
||||||
|
|
Loading…
Reference in New Issue