From f06f220c7c8de5fe4a08cf7d6d9531a0a564ee12 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Mon, 15 Jun 2015 16:33:36 +0200 Subject: [PATCH] added printing support for objects --- cmd/console/js.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/console/js.go b/cmd/console/js.go index bda58be4d..15ea9bedd 100644 --- a/cmd/console/js.go +++ b/cmd/console/js.go @@ -332,11 +332,13 @@ func (self *jsre) welcome(ipcpath string) { func (self *jsre) batch(args cli.Args) { statement := strings.Join(args, " ") - val, err := self.re.Run(statement) if err != nil { 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() { fmt.Printf("%v", val) } @@ -346,7 +348,6 @@ func (self *jsre) batch(args cli.Args) { } self.re.Stop(false) - } func (self *jsre) interactive(ipcpath string) {