DiffFiles shows the diffs between this file as the A file, and other file as B file, in a DiffEditorDialog
(ctx core.Widget, afile, bfile string)
| 32 | // DiffFiles shows the diffs between this file as the A file, and other file as B file, |
| 33 | // in a DiffEditorDialog |
| 34 | func DiffFiles(ctx core.Widget, afile, bfile string) (*DiffEditor, error) { |
| 35 | ab, err := os.ReadFile(afile) |
| 36 | if err != nil { |
| 37 | slog.Error(err.Error()) |
| 38 | return nil, err |
| 39 | } |
| 40 | bb, err := os.ReadFile(bfile) |
| 41 | if err != nil { |
| 42 | slog.Error(err.Error()) |
| 43 | return nil, err |
| 44 | } |
| 45 | astr := stringsx.SplitLines(string(ab)) |
| 46 | bstr := stringsx.SplitLines(string(bb)) |
| 47 | dlg := DiffEditorDialog(ctx, "Diff File View", astr, bstr, afile, bfile, "", "") |
| 48 | return dlg, nil |
| 49 | } |
| 50 | |
| 51 | // DiffEditorDialogFromRevs opens a dialog for displaying diff between file |
| 52 | // at two different revisions from given repository |
no test coverage detected