mirror of https://github.com/Hilbis/Hilbish
parent
06221e06cd
commit
e3a0195eb3
19
api.go
19
api.go
|
@ -14,7 +14,6 @@ import (
|
||||||
|
|
||||||
"hilbish/util"
|
"hilbish/util"
|
||||||
|
|
||||||
"github.com/pborman/getopt"
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
"mvdan.cc/sh/v3/interp"
|
"mvdan.cc/sh/v3/interp"
|
||||||
)
|
)
|
||||||
|
@ -24,7 +23,6 @@ var exports = map[string]lua.LGFunction {
|
||||||
"appendPath": hlappendPath,
|
"appendPath": hlappendPath,
|
||||||
"cwd": hlcwd,
|
"cwd": hlcwd,
|
||||||
"exec": hlexec,
|
"exec": hlexec,
|
||||||
"flag": hlflag,
|
|
||||||
"multiprompt": hlmlprompt,
|
"multiprompt": hlmlprompt,
|
||||||
"prependPath": hlprependPath,
|
"prependPath": hlprependPath,
|
||||||
"prompt": hlprompt,
|
"prompt": hlprompt,
|
||||||
|
@ -101,23 +99,6 @@ func hlrun(L *lua.LState) int {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// flag(f)
|
|
||||||
// Checks if the `f` flag has been passed to Hilbish.
|
|
||||||
func hlflag(L *lua.LState) int {
|
|
||||||
flagchar := L.CheckString(1)
|
|
||||||
|
|
||||||
flag := getopt.Lookup([]rune(flagchar)[0])
|
|
||||||
if flag == nil {
|
|
||||||
L.Push(lua.LNil)
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
passed := flag.Seen()
|
|
||||||
L.Push(lua.LBool(passed))
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
// cwd()
|
// cwd()
|
||||||
// Returns the current directory of the shell
|
// Returns the current directory of the shell
|
||||||
func hlcwd(L *lua.LState) int {
|
func hlcwd(L *lua.LState) int {
|
||||||
|
|
Loading…
Reference in New Issue