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
ae38871a
Commit
ae38871a
authored
Mar 10, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/ethereum: remove "prompter" in identifiers
parent
62ebce30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
js.go
cmd/ethereum/js.go
+10
-9
No files found.
cmd/ethereum/js.go
View file @
ae38871a
...
@@ -41,14 +41,14 @@ type prompter interface {
...
@@ -41,14 +41,14 @@ type prompter interface {
PasswordPrompt
(
p
string
)
(
string
,
error
)
PasswordPrompt
(
p
string
)
(
string
,
error
)
}
}
type
dumb
Prompter
struct
{
r
*
bufio
.
Reader
}
type
dumb
term
struct
{
r
*
bufio
.
Reader
}
func
(
r
dumb
Prompter
)
Prompt
(
p
string
)
(
string
,
error
)
{
func
(
r
dumb
term
)
Prompt
(
p
string
)
(
string
,
error
)
{
fmt
.
Print
(
p
)
fmt
.
Print
(
p
)
return
r
.
r
.
ReadString
(
'\n'
)
return
r
.
r
.
ReadString
(
'\n'
)
}
}
func
(
r
dumb
Prompter
)
PasswordPrompt
(
p
string
)
(
string
,
error
)
{
func
(
r
dumb
term
)
PasswordPrompt
(
p
string
)
(
string
,
error
)
{
fmt
.
Println
(
"!! Unsupported terminal, password will echo."
)
fmt
.
Println
(
"!! Unsupported terminal, password will echo."
)
fmt
.
Print
(
p
)
fmt
.
Print
(
p
)
input
,
err
:=
bufio
.
NewReader
(
os
.
Stdin
)
.
ReadString
(
'\n'
)
input
,
err
:=
bufio
.
NewReader
(
os
.
Stdin
)
.
ReadString
(
'\n'
)
...
@@ -56,13 +56,14 @@ func (r dumbPrompter) PasswordPrompt(p string) (string, error) {
...
@@ -56,13 +56,14 @@ func (r dumbPrompter) PasswordPrompt(p string) (string, error) {
return
input
,
err
return
input
,
err
}
}
func
(
r
dumb
Prompter
)
AppendHistory
(
string
)
{}
func
(
r
dumb
term
)
AppendHistory
(
string
)
{}
type
jsre
struct
{
type
jsre
struct
{
re
*
javascript
.
JSRE
re
*
javascript
.
JSRE
ethereum
*
eth
.
Ethereum
ethereum
*
eth
.
Ethereum
xeth
*
xeth
.
XEth
xeth
*
xeth
.
XEth
ps1
string
ps1
string
prompter
prompter
}
}
...
@@ -73,7 +74,7 @@ func newJSRE(ethereum *eth.Ethereum) *jsre {
...
@@ -73,7 +74,7 @@ func newJSRE(ethereum *eth.Ethereum) *jsre {
js
.
initStdFuncs
()
js
.
initStdFuncs
()
if
!
liner
.
TerminalSupported
()
{
if
!
liner
.
TerminalSupported
()
{
js
.
prompter
=
dumb
Prompter
{
bufio
.
NewReader
(
os
.
Stdin
)}
js
.
prompter
=
dumb
term
{
bufio
.
NewReader
(
os
.
Stdin
)}
}
else
{
}
else
{
lr
:=
liner
.
NewLiner
()
lr
:=
liner
.
NewLiner
()
lr
.
SetCtrlCAborts
(
true
)
lr
.
SetCtrlCAborts
(
true
)
...
@@ -87,13 +88,13 @@ func newJSRE(ethereum *eth.Ethereum) *jsre {
...
@@ -87,13 +88,13 @@ func newJSRE(ethereum *eth.Ethereum) *jsre {
func
(
self
*
jsre
)
ConfirmTransaction
(
tx
*
types
.
Transaction
)
bool
{
func
(
self
*
jsre
)
ConfirmTransaction
(
tx
*
types
.
Transaction
)
bool
{
p
:=
fmt
.
Sprintf
(
"Confirm Transaction %v
\n
[y/n] "
,
tx
)
p
:=
fmt
.
Sprintf
(
"Confirm Transaction %v
\n
[y/n] "
,
tx
)
answer
,
_
:=
self
.
prompter
.
Prompt
(
p
)
answer
,
_
:=
self
.
Prompt
(
p
)
return
strings
.
HasPrefix
(
strings
.
Trim
(
answer
,
" "
),
"y"
)
return
strings
.
HasPrefix
(
strings
.
Trim
(
answer
,
" "
),
"y"
)
}
}
func
(
self
*
jsre
)
UnlockAccount
(
addr
[]
byte
)
bool
{
func
(
self
*
jsre
)
UnlockAccount
(
addr
[]
byte
)
bool
{
fmt
.
Printf
(
"Please unlock account %x.
\n
"
,
addr
)
fmt
.
Printf
(
"Please unlock account %x.
\n
"
,
addr
)
pass
,
err
:=
self
.
prompter
.
PasswordPrompt
(
"Passphrase: "
)
pass
,
err
:=
self
.
PasswordPrompt
(
"Passphrase: "
)
if
err
!=
nil
{
if
err
!=
nil
{
return
false
return
false
}
}
...
@@ -124,7 +125,7 @@ func (self *jsre) exec(filename string) error {
...
@@ -124,7 +125,7 @@ func (self *jsre) exec(filename string) error {
func
(
self
*
jsre
)
interactive
()
{
func
(
self
*
jsre
)
interactive
()
{
for
{
for
{
input
,
err
:=
self
.
prompter
.
Prompt
(
self
.
ps1
)
input
,
err
:=
self
.
Prompt
(
self
.
ps1
)
if
err
!=
nil
{
if
err
!=
nil
{
return
return
}
}
...
@@ -138,7 +139,7 @@ func (self *jsre) interactive() {
...
@@ -138,7 +139,7 @@ func (self *jsre) interactive() {
return
return
}
}
hist
:=
str
[
:
len
(
str
)
-
1
]
hist
:=
str
[
:
len
(
str
)
-
1
]
self
.
prompter
.
AppendHistory
(
hist
)
self
.
AppendHistory
(
hist
)
self
.
parseInput
(
str
)
self
.
parseInput
(
str
)
str
=
""
str
=
""
}
}
...
...
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