added batch support to console and attach actions
This commit is contained in:
committed by
Bas van Kervel
parent
3ff272b618
commit
f87501b1c5
@ -220,6 +220,25 @@ func (self *jsre) loadAutoCompletion() {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *jsre) batch(statement string) {
|
||||
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)
|
||||
}
|
||||
|
||||
if self.atexit != nil {
|
||||
self.atexit()
|
||||
}
|
||||
|
||||
self.re.Stop(false)
|
||||
}
|
||||
|
||||
// show summary of current geth instance
|
||||
func (self *jsre) welcome() {
|
||||
self.re.Eval(`console.log('instance: ' + web3.version.client);`)
|
||||
|
Reference in New Issue
Block a user