aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/history_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 11:05:13 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 11:05:13 +0200
commitadc3410395771609d2db5ee5ae2b9da71115c5ca (patch)
tree453def41e18f607332be1088920f9d0c563603a3 /cmd/krino/history_test.go
parent0468ce38470aa3ae8092b92d4f77e72d25dfa108 (diff)
downloadkrino-adc3410395771609d2db5ee5ae2b9da71115c5ca.tar.gz
krino-adc3410395771609d2db5ee5ae2b9da71115c5ca.zip
krino: coloured output, and --no-color
One palette type styles the plan table, warnings, headers, outcome counts, prompt keys, undo's refused steps and krino log's (undone), from the 16-colour ANSI palette plus bold and faint only. Widths are measured on the plain text, so columns line up; with colour off the output is unchanged. --no-color works before or after any subcommand, as NO_COLOR does. The two search-and-replace colourings are gone.
Diffstat (limited to 'cmd/krino/history_test.go')
-rw-r--r--cmd/krino/history_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/cmd/krino/history_test.go b/cmd/krino/history_test.go
index 23b1e5f..f76ac66 100644
--- a/cmd/krino/history_test.go
+++ b/cmd/krino/history_test.go
@@ -150,7 +150,7 @@ func TestFinalizeUndoPlanMarksUnapprovedAsDeclined(t *testing.T) {
// TestReviewUndoApplyAll: [a] approves every reversible file by index.
func TestReviewUndoApplyAll(t *testing.T) {
- approved, action, err := reviewUndoFiles(strings.NewReader("a"), new(strings.Builder), undoFiles("a", "b"))
+ approved, action, err := reviewUndoFiles(strings.NewReader("a"), new(strings.Builder), undoFiles("a", "b"), palette{})
if err != nil {
t.Fatal(err)
}
@@ -161,11 +161,11 @@ func TestReviewUndoApplyAll(t *testing.T) {
// TestReviewUndoSkipAndQuit: [s] and [q] both approve nothing.
func TestReviewUndoSkipAndQuit(t *testing.T) {
- approved, action, _ := reviewUndoFiles(strings.NewReader("s"), new(strings.Builder), undoFiles("a", "b"))
+ approved, action, _ := reviewUndoFiles(strings.NewReader("s"), new(strings.Builder), undoFiles("a", "b"), palette{})
if action != 's' || len(approved) != 0 {
t.Errorf("[s] = %q %v; want nothing approved", action, approved)
}
- approved, action, _ = reviewUndoFiles(strings.NewReader("q"), new(strings.Builder), undoFiles("a", "b"))
+ approved, action, _ = reviewUndoFiles(strings.NewReader("q"), new(strings.Builder), undoFiles("a", "b"), palette{})
if action != 'q' || len(approved) != 0 {
t.Errorf("[q] = %q %v; want nothing approved", action, approved)
}
@@ -173,7 +173,7 @@ func TestReviewUndoSkipAndQuit(t *testing.T) {
// TestReviewUndoChoosePerFile: [c] then per-file y/n, keyed by index.
func TestReviewUndoChoosePerFile(t *testing.T) {
- approved, action, err := reviewUndoFiles(strings.NewReader("cyn"), new(strings.Builder), undoFiles("a", "b"))
+ approved, action, err := reviewUndoFiles(strings.NewReader("cyn"), new(strings.Builder), undoFiles("a", "b"), palette{})
if err != nil {
t.Fatal(err)
}
@@ -195,7 +195,7 @@ func TestReviewUndoRefusedFileNotPrompted(t *testing.T) {
files := undoFiles("a", "b", "c")
files[1].Refused = "b changed since the run"
out := new(strings.Builder)
- approved, action, err := reviewUndoFiles(strings.NewReader("cyn"), out, files)
+ approved, action, err := reviewUndoFiles(strings.NewReader("cyn"), out, files, palette{})
if err != nil {
t.Fatal(err)
}
@@ -304,7 +304,7 @@ func TestPrintUndoPlan(t *testing.T) {
// TestInvalidKeyReprompts for the undo-specific menu.
func TestReviewUndoInvalidKeyReprompts(t *testing.T) {
out := new(strings.Builder)
- approved, action, err := reviewUndoFiles(strings.NewReader("zs"), out, undoFiles("a"))
+ approved, action, err := reviewUndoFiles(strings.NewReader("zs"), out, undoFiles("a"), palette{})
if err != nil {
t.Fatal(err)
}