mirror of
https://github.com/robertkrimen/otto
synced 2025-09-28 18:45:22 +08:00
Add underscore to the commandline
This commit is contained in:
parent
5958af6914
commit
c2851c6b6e
|
@ -6,8 +6,11 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"github.com/robertkrimen/otto"
|
"github.com/robertkrimen/otto"
|
||||||
|
"github.com/robertkrimen/otto/underscore"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var underscoreFlag *bool = flag.Bool("underscore", true, "Load underscore into the runtime environment")
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
var script []byte
|
var script []byte
|
||||||
|
@ -26,6 +29,9 @@ func main() {
|
||||||
os.Exit(64)
|
os.Exit(64)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if !*underscoreFlag {
|
||||||
|
underscore.Disable()
|
||||||
|
}
|
||||||
Otto := otto.New()
|
Otto := otto.New()
|
||||||
_, err = Otto.Run(string(script))
|
_, err = Otto.Run(string(script))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user