Commit adc1b503 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

Merge pull request #2567 from fjl/console-history-exclude

cmd/geth: fix console history exclusion
parents fe532a98 86da6feb
...@@ -42,7 +42,6 @@ import ( ...@@ -42,7 +42,6 @@ import (
var ( var (
passwordRegexp = regexp.MustCompile("personal.[nu]") passwordRegexp = regexp.MustCompile("personal.[nu]")
leadingSpace = regexp.MustCompile("^ ")
onlyws = regexp.MustCompile("^\\s*$") onlyws = regexp.MustCompile("^\\s*$")
exit = regexp.MustCompile("^\\s*exit\\s*;*\\s*$") exit = regexp.MustCompile("^\\s*exit\\s*;*\\s*$")
) )
...@@ -361,7 +360,7 @@ func (self *jsre) interactive() { ...@@ -361,7 +360,7 @@ func (self *jsre) interactive() {
str += input + "\n" str += input + "\n"
self.setIndent() self.setIndent()
if indentCount <= 0 { if indentCount <= 0 {
if mustLogInHistory(str) { if !excludeFromHistory(str) {
utils.Stdin.AppendHistory(str[:len(str)-1]) utils.Stdin.AppendHistory(str[:len(str)-1])
} }
self.parseInput(str) self.parseInput(str)
...@@ -371,10 +370,8 @@ func (self *jsre) interactive() { ...@@ -371,10 +370,8 @@ func (self *jsre) interactive() {
} }
} }
func mustLogInHistory(input string) bool { func excludeFromHistory(input string) bool {
return len(input) == 0 || return len(input) == 0 || input[0] == ' ' || passwordRegexp.MatchString(input)
passwordRegexp.MatchString(input) ||
!leadingSpace.MatchString(input)
} }
func (self *jsre) withHistory(datadir string, op func(*os.File)) { func (self *jsre) withHistory(datadir string, op func(*os.File)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment