mirror of https://github.com/Hilbis/Hilbish
feat: args variable (resolves #49)
anytime hilbish is ran as shebang or given a script to run, itll provide an `args` variable which will be the args a user provides to the script. it includes the execute path, as most argv's dopull/59/head
parent
0f9d3732fb
commit
fd478e883f
2
main.go
2
main.go
|
@ -14,6 +14,7 @@ import (
|
|||
"github.com/pborman/getopt"
|
||||
"github.com/bobappleyard/readline"
|
||||
"github.com/yuin/gopher-lua"
|
||||
"layeh.com/gopher-luar"
|
||||
"golang.org/x/term"
|
||||
)
|
||||
|
||||
|
@ -118,6 +119,7 @@ func main() {
|
|||
|
||||
RunInput(*cmdflag)
|
||||
if getopt.NArgs() > 0 {
|
||||
l.SetGlobal("args", luar.New(l, getopt.Args()))
|
||||
err := l.DoFile(getopt.Arg(0))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
|
|
Loading…
Reference in New Issue