]> ruderich.org/simon Gitweb - safcm/safcm.git/commitdiff
changes: add "(hidden)" to commands with no output and quiet mode
authorSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 18:20:16 +0000 (20:20 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 9 May 2021 18:20:16 +0000 (20:20 +0200)
This should make it more obvious why these commands are not shown.

cmd/safcm/sync_changes.go
cmd/safcm/sync_changes_test.go

index f597ae1a7fdc6b3532bbc1f15a22a3dae7ae2b4b..2650bb46062b33ab0f86e75d9b0f0cb1643bf556 100644 (file)
@@ -205,7 +205,7 @@ func (s *Sync) formatCommandChanges(changes []safcm.CommandChange) string {
                fmt.Fprintf(&buf, "executed %d command(s)", len(changes))
        }
        if noOutput > 0 && !s.config.DryRun {
-               fmt.Fprintf(&buf, ", %d with no output", noOutput)
+               fmt.Fprintf(&buf, ", %d with no output (hidden)", noOutput)
        }
        if noOutput != len(changes) {
                fmt.Fprintf(&buf, ":")
index feb8dd34531f007072b391fbc11b82b1e05d3a50..219373c9522e4edfba458d3dd410b306c7ccdb06 100644 (file)
@@ -1083,7 +1083,7 @@ func TestFormatCommandChanges(t *testing.T) {
                                        Error:   "fake error",
                                },
                        },
-                       `executed 5 command(s), 1 with no output:
+                       `executed 5 command(s), 1 with no output (hidden):
 "fake command":
    > fake output
    > \ No newline at end of file
@@ -1126,7 +1126,7 @@ func TestFormatCommandChanges(t *testing.T) {
                                        Error:   "fake error",
                                },
                        },
-                       "executed 5 command(s), 1 with no output:\n\x1b[36m\"fake command\"\x1b[0m:\n   > fake output\n   > \\ No newline at end of file\n\x1b[36m\"fake command with newline\"\x1b[0m:\n   > fake output\n\x1b[36m\"fake command with more output\"\x1b[0m:\n   > fake out\n   > fake put\n   > fake\n\x1b[36m\"fake failed command\"\x1b[0m, failed: \"fake error\":\n   > fake output\n   > \\ No newline at end of file\n",
+                       "executed 5 command(s), 1 with no output (hidden):\n\x1b[36m\"fake command\"\x1b[0m:\n   > fake output\n   > \\ No newline at end of file\n\x1b[36m\"fake command with newline\"\x1b[0m:\n   > fake output\n\x1b[36m\"fake command with more output\"\x1b[0m:\n   > fake out\n   > fake put\n   > fake\n\x1b[36m\"fake failed command\"\x1b[0m, failed: \"fake error\":\n   > fake output\n   > \\ No newline at end of file\n",
                },
 
                {
@@ -1142,7 +1142,7 @@ func TestFormatCommandChanges(t *testing.T) {
                                        Command: "fake command with no output",
                                },
                        },
-                       `executed 2 command(s), 2 with no output
+                       `executed 2 command(s), 2 with no output (hidden)
 `,
                },
 
@@ -1160,7 +1160,7 @@ func TestFormatCommandChanges(t *testing.T) {
                                        Command: "fake command with no output",
                                },
                        },
-                       `executed 2 command(s), 1 with no output:
+                       `executed 2 command(s), 1 with no output (hidden):
 "fake command with no output but error", failed: "fake error"
 `,
                },