aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-05-17 18:04:58 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-05-17 18:04:58 +0800
commitadc1b503957e572c4ec30533de3ec28ec6feea13 (patch)
tree834170561918126b4ad29801451f9ae2585b3431
parentfe532a98f9f32bb81ef0d8d013cf44327830d11e (diff)
parent86da6feb40fd366c75236d87fa306576c51ed2a8 (diff)
downloaddexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar.gz
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar.bz2
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar.lz
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar.xz
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.tar.zst
dexon-adc1b503957e572c4ec30533de3ec28ec6feea13.zip
Merge pull request #2567 from fjl/console-history-exclude
cmd/geth: fix console history exclusion
-rw-r--r--cmd/geth/js.go9
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/geth/js.go b/cmd/geth/js.go
index 25c4d1a21..026e5570d 100644
--- a/cmd/geth/js.go
+++ b/cmd/geth/js.go
@@ -42,7 +42,6 @@ import (
var (
passwordRegexp = regexp.MustCompile("personal.[nu]")
- leadingSpace = regexp.MustCompile("^ ")
onlyws = regexp.MustCompile("^\\s*$")
exit = regexp.MustCompile("^\\s*exit\\s*;*\\s*$")
)
@@ -361,7 +360,7 @@ func (self *jsre) interactive() {
str += input + "\n"
self.setIndent()
if indentCount <= 0 {
- if mustLogInHistory(str) {
+ if !excludeFromHistory(str) {
utils.Stdin.AppendHistory(str[:len(str)-1])
}
self.parseInput(str)
@@ -371,10 +370,8 @@ func (self *jsre) interactive() {
}
}
-func mustLogInHistory(input string) bool {
- return len(input) == 0 ||
- passwordRegexp.MatchString(input) ||
- !leadingSpace.MatchString(input)
+func excludeFromHistory(input string) bool {
+ return len(input) == 0 || input[0] == ' ' || passwordRegexp.MatchString(input)
}
func (self *jsre) withHistory(datadir string, op func(*os.File)) {