diff options
| author | Dax Raad <[email protected]> | 2025-11-02 18:43:17 -0500 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2025-11-02 18:43:33 -0500 |
| commit | f68374ad2223ddc213bdea9519ca6a699819ee0e (patch) | |
| tree | 04f0fe21b8e12cd62d7274961bb0cff64f966f40 /packages/tui/internal/components/diff/parse.go | |
| parent | 5e86c9b7916f75c7ad227b80eab18c7c54fc8ffe (diff) | |
| download | opencode-f68374ad2223ddc213bdea9519ca6a699819ee0e.tar.gz opencode-f68374ad2223ddc213bdea9519ca6a699819ee0e.zip | |
DELETE GO BUBBLETEA CRAP HOORAY
Diffstat (limited to 'packages/tui/internal/components/diff/parse.go')
| -rw-r--r-- | packages/tui/internal/components/diff/parse.go | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/packages/tui/internal/components/diff/parse.go b/packages/tui/internal/components/diff/parse.go deleted file mode 100644 index 261ba5970..000000000 --- a/packages/tui/internal/components/diff/parse.go +++ /dev/null @@ -1,58 +0,0 @@ -package diff - -import ( - "bufio" - "fmt" - "strings" -) - -type DiffStats struct { - Added int - Removed int - Modified int -} - -func ParseStats(diff string) (map[string]DiffStats, error) { - stats := make(map[string]DiffStats) - var currentFile string - scanner := bufio.NewScanner(strings.NewReader(diff)) - - for scanner.Scan() { - line := scanner.Text() - if strings.HasPrefix(line, "---") { - continue - } else if strings.HasPrefix(line, "+++") { - parts := strings.SplitN(line, " ", 2) - if len(parts) == 2 { - currentFile = strings.TrimPrefix(parts[1], "b/") - } - continue - } - if strings.HasPrefix(line, "@@") { - continue - } - if currentFile == "" { - continue - } - - fileStats := stats[currentFile] - switch { - case strings.HasPrefix(line, "+"): - fileStats.Added++ - case strings.HasPrefix(line, "-"): - fileStats.Removed++ - } - stats[currentFile] = fileStats - } - - if err := scanner.Err(); err != nil { - return nil, fmt.Errorf("error reading diff string: %w", err) - } - - for file, fileStats := range stats { - fileStats.Modified = fileStats.Added + fileStats.Removed - stats[file] = fileStats - } - - return stats, nil -} |
