diff options
Diffstat (limited to 'cmd/console/js.go')
-rw-r--r-- | cmd/console/js.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/cmd/console/js.go b/cmd/console/js.go index a5fdaacc2..bda58be4d 100644 --- a/cmd/console/js.go +++ b/cmd/console/js.go @@ -30,6 +30,7 @@ import ( "sort" + "github.com/codegangsta/cli" "github.com/ethereum/go-ethereum/cmd/utils" "github.com/ethereum/go-ethereum/common/docserver" re "github.com/ethereum/go-ethereum/jsre" @@ -329,7 +330,28 @@ func (self *jsre) welcome(ipcpath string) { } } -func (self *jsre) interactive() { +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() { + fmt.Printf("%v", val) + } + + if self.atexit != nil { + self.atexit() + } + + self.re.Stop(false) + +} + +func (self *jsre) interactive(ipcpath string) { + self.welcome(ipcpath) + // Read input lines. prompt := make(chan string) inputln := make(chan string) |