aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum/repl_darwin.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-19 22:32:45 +0800
committerobscuren <geffobscura@gmail.com>2014-05-19 22:32:45 +0800
commit017bbbb582b09a3264b4ff996f35275d381f284f (patch)
treeb11fba658b414029b78958ddb6137634e7ccf966 /ethereum/repl_darwin.go
parent16421106d47efb65331ed9f0499f12038158cbf1 (diff)
downloaddexon-017bbbb582b09a3264b4ff996f35275d381f284f.tar.gz
dexon-017bbbb582b09a3264b4ff996f35275d381f284f.tar.zst
dexon-017bbbb582b09a3264b4ff996f35275d381f284f.zip
Improved REPL output
Diffstat (limited to 'ethereum/repl_darwin.go')
-rw-r--r--ethereum/repl_darwin.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/ethereum/repl_darwin.go b/ethereum/repl_darwin.go
index 483d4cedf..87da3df1d 100644
--- a/ethereum/repl_darwin.go
+++ b/ethereum/repl_darwin.go
@@ -8,6 +8,7 @@ package main
import "C"
import (
+ "github.com/robertkrimen/otto"
"strings"
"unsafe"
)
@@ -63,18 +64,30 @@ L:
for {
switch result := readLine(&self.prompt); true {
case result == nil:
- break L //exit loop
+ break L
- case *result != "": //ignore blank lines
+ case *result != "":
str += *result + "\n"
self.setIndent()
if indentCount <= 0 {
+ if *result == "exit" {
+ self.Stop()
+ break L
+ }
+
addHistory(str) //allow user to recall this line
self.parseInput(str)
+
+ str = ""
}
}
}
}
+
+func (self *JSRepl) PrintValue(value otto.Value) {
+ method, _ := self.re.vm.Get("prettyPrint")
+ method.Call(method, value)
+}