|
47 | 47 |
|
48 | 48 | //go:embed shellintegration/pwsh_wavepwsh.sh |
49 | 49 | PwshStartup_wavepwsh string |
| 50 | + |
| 51 | + ZshExtendedHistoryPattern = regexp.MustCompile(`^: [0-9]+:`) |
50 | 52 | ) |
51 | 53 |
|
52 | 54 | const DefaultTermType = "xterm-256color" |
@@ -238,13 +240,12 @@ func IsExtendedZshHistoryFile(fileName string) (bool, error) { |
238 | 240 | content := string(buf[:n]) |
239 | 241 | lines := strings.Split(content, "\n") |
240 | 242 |
|
241 | | - extendedPattern := regexp.MustCompile(`^: [0-9]+:`) |
242 | 243 | for _, line := range lines { |
243 | 244 | line = strings.TrimSpace(line) |
244 | 245 | if line == "" { |
245 | 246 | continue |
246 | 247 | } |
247 | | - return extendedPattern.MatchString(line), nil |
| 248 | + return ZshExtendedHistoryPattern.MatchString(line), nil |
248 | 249 | } |
249 | 250 |
|
250 | 251 | return false, nil |
@@ -478,7 +479,10 @@ func FixupWaveZshHistory() error { |
478 | 479 | waveHistFile := filepath.Join(zshDir, ZshHistoryFileName) |
479 | 480 |
|
480 | 481 | if size == 0 { |
481 | | - os.Remove(waveHistFile) |
| 482 | + err := os.Remove(waveHistFile) |
| 483 | + if err != nil { |
| 484 | + log.Printf("error removing wave zsh history file %s: %v\n", waveHistFile, err) |
| 485 | + } |
482 | 486 | return nil |
483 | 487 | } |
484 | 488 |
|
@@ -521,7 +525,10 @@ func FixupWaveZshHistory() error { |
521 | 525 | return fmt.Errorf("error executing zsh history fixup script: %w, output: %s", err, string(output)) |
522 | 526 | } |
523 | 527 |
|
524 | | - os.Remove(waveHistFile) |
| 528 | + err = os.Remove(waveHistFile) |
| 529 | + if err != nil { |
| 530 | + log.Printf("error removing wave zsh history file %s: %v\n", waveHistFile, err) |
| 531 | + } |
525 | 532 | log.Printf("successfully merged wave zsh history %s into ~/.zsh_history\n", waveHistFile) |
526 | 533 |
|
527 | 534 | return nil |
|
0 commit comments