diff options
author | Felix Lange <fjl@twurst.com> | 2015-03-10 09:33:59 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-03-10 09:33:59 +0800 |
commit | ae38871a54b1ccb51346ce5d99beb863b7febe66 (patch) | |
tree | 4d332ce7dd2274286c1284d107d3f85742a3570e /cmd | |
parent | 62ebce304edcdd9d0c1022b57d9e744013c0818f (diff) | |
download | dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar.gz dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar.bz2 dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar.lz dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar.xz dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.tar.zst dexon-ae38871a54b1ccb51346ce5d99beb863b7febe66.zip |
cmd/ethereum: remove "prompter" in identifiers
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/ethereum/js.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cmd/ethereum/js.go b/cmd/ethereum/js.go index 96e292733..de73e83a2 100644 --- a/cmd/ethereum/js.go +++ b/cmd/ethereum/js.go @@ -41,14 +41,14 @@ type prompter interface { PasswordPrompt(p string) (string, error) } -type dumbPrompter struct{ r *bufio.Reader } +type dumbterm struct{ r *bufio.Reader } -func (r dumbPrompter) Prompt(p string) (string, error) { +func (r dumbterm) Prompt(p string) (string, error) { fmt.Print(p) return r.r.ReadString('\n') } -func (r dumbPrompter) PasswordPrompt(p string) (string, error) { +func (r dumbterm) PasswordPrompt(p string) (string, error) { fmt.Println("!! Unsupported terminal, password will echo.") fmt.Print(p) input, err := bufio.NewReader(os.Stdin).ReadString('\n') @@ -56,13 +56,14 @@ func (r dumbPrompter) PasswordPrompt(p string) (string, error) { return input, err } -func (r dumbPrompter) AppendHistory(string) {} +func (r dumbterm) AppendHistory(string) {} type jsre struct { re *javascript.JSRE ethereum *eth.Ethereum xeth *xeth.XEth ps1 string + prompter } @@ -73,7 +74,7 @@ func newJSRE(ethereum *eth.Ethereum) *jsre { js.initStdFuncs() if !liner.TerminalSupported() { - js.prompter = dumbPrompter{bufio.NewReader(os.Stdin)} + js.prompter = dumbterm{bufio.NewReader(os.Stdin)} } else { lr := liner.NewLiner() lr.SetCtrlCAborts(true) @@ -87,13 +88,13 @@ func newJSRE(ethereum *eth.Ethereum) *jsre { func (self *jsre) ConfirmTransaction(tx *types.Transaction) bool { 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") } func (self *jsre) UnlockAccount(addr []byte) bool { fmt.Printf("Please unlock account %x.\n", addr) - pass, err := self.prompter.PasswordPrompt("Passphrase: ") + pass, err := self.PasswordPrompt("Passphrase: ") if err != nil { return false } @@ -124,7 +125,7 @@ func (self *jsre) exec(filename string) error { func (self *jsre) interactive() { for { - input, err := self.prompter.Prompt(self.ps1) + input, err := self.Prompt(self.ps1) if err != nil { return } @@ -138,7 +139,7 @@ func (self *jsre) interactive() { return } hist := str[:len(str)-1] - self.prompter.AppendHistory(hist) + self.AppendHistory(hist) self.parseInput(str) str = "" } |