()
| 184 | } |
| 185 | |
| 186 | func loadHistory() []string { |
| 187 | path := historyPath() |
| 188 | if path == "" { |
| 189 | return nil |
| 190 | } |
| 191 | f, err := os.Open(path) |
| 192 | if err != nil { |
| 193 | return nil |
| 194 | } |
| 195 | defer f.Close() |
| 196 | var lines []string |
| 197 | s := bufio.NewScanner(f) |
| 198 | s.Buffer(make([]byte, 0, 64*1024), 1024*1024) |
| 199 | for s.Scan() { |
| 200 | if s.Text() != "" { |
| 201 | lines = append(lines, s.Text()) |
| 202 | } |
| 203 | } |
| 204 | return lines |
| 205 | } |
| 206 | |
| 207 | func appendHistory(line string) { |
| 208 | path := historyPath() |
no test coverage detected