Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
ae36beb3
Commit
ae36beb3
authored
Jun 17, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1269 from bas-vk/console-batch
added batch mode to console
parents
e4b54f18
f06f220c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
5 deletions
+31
-5
js.go
cmd/console/js.go
+24
-1
main.go
cmd/console/main.go
+7
-4
No files found.
cmd/console/js.go
View file @
ae36beb3
...
...
@@ -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,29 @@ 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
()
&&
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
)
}
func
(
self
*
jsre
)
interactive
(
ipcpath
string
)
{
self
.
welcome
(
ipcpath
)
// Read input lines.
prompt
:=
make
(
chan
string
)
inputln
:=
make
(
chan
string
)
...
...
cmd/console/main.go
View file @
ae36beb3
...
...
@@ -40,7 +40,7 @@ const (
var
(
gitCommit
string
// set via linker flag
nodeNameVersion
string
app
=
utils
.
NewApp
(
Version
,
"the
ether
console"
)
app
=
utils
.
NewApp
(
Version
,
"the
geth
console"
)
)
func
init
()
{
...
...
@@ -93,8 +93,11 @@ func main() {
func
run
(
ctx
*
cli
.
Context
)
{
jspath
:=
ctx
.
GlobalString
(
utils
.
JSpathFlag
.
Name
)
ipcpath
:=
utils
.
IpcSocketPath
(
ctx
)
repl
:=
newJSRE
(
jspath
,
ipcpath
)
repl
.
welcome
(
ipcpath
)
repl
.
interactive
()
if
ctx
.
Args
()
.
Present
()
{
repl
.
batch
(
ctx
.
Args
())
}
else
{
repl
.
interactive
(
ipcpath
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment