We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c65ac81 commit fb4306dCopy full SHA for fb4306d
1 file changed
cmd/repl/prompt.go
@@ -70,6 +70,7 @@ type promptState struct {
70
livePrefix string
71
enableLivePrefix bool
72
statement string
73
+ lastStatement string
74
keywords []string
75
history []string
76
historyFileName string
@@ -90,6 +91,7 @@ func (p *promptState) execute(in string, cb func(string)) {
90
91
p.enableLivePrefix = false
92
fmt.Println()
93
cb(p.statement)
94
+ p.lastStatement = p.statement
95
p.statement = ""
96
return
97
}
@@ -137,7 +139,7 @@ func (p *promptState) initHistory() {
137
139
138
140
141
func (p *promptState) updateHistory() {
- if p.statement != "" {
142
+ if p.statement != "" && p.statement != p.lastStatement {
143
f, err := os.OpenFile(p.historyFileName, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
144
if err != nil {
145
0 commit comments