added printing support for objects
This commit is contained in:
parent
2a0528303f
commit
f06f220c7c
|
@ -332,11 +332,13 @@ func (self *jsre) welcome(ipcpath string) {
|
||||||
|
|
||||||
func (self *jsre) batch(args cli.Args) {
|
func (self *jsre) batch(args cli.Args) {
|
||||||
statement := strings.Join(args, " ")
|
statement := strings.Join(args, " ")
|
||||||
|
|
||||||
val, err := self.re.Run(statement)
|
val, err := self.re.Run(statement)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("error: %v", err)
|
fmt.Printf("error: %v", err)
|
||||||
|
} else if val.IsDefined() && val.IsObject() {
|
||||||
|
obj, _ := self.re.Get("ret_result")
|
||||||
|
fmt.Printf("%v", obj)
|
||||||
} else if val.IsDefined() {
|
} else if val.IsDefined() {
|
||||||
fmt.Printf("%v", val)
|
fmt.Printf("%v", val)
|
||||||
}
|
}
|
||||||
|
@ -346,7 +348,6 @@ func (self *jsre) batch(args cli.Args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.re.Stop(false)
|
self.re.Stop(false)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *jsre) interactive(ipcpath string) {
|
func (self *jsre) interactive(ipcpath string) {
|
||||||
|
|
Loading…
Reference in New Issue