Commit f06f220c authored by Bas van Kervel's avatar Bas van Kervel

added printing support for objects

parent 2a052830
...@@ -332,11 +332,13 @@ func (self *jsre) welcome(ipcpath string) { ...@@ -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) { ...@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment