The goal of quiet is to get a quick overview what is happening or what
is going to happen (when combined with dry-run). While quiet worked fine
for non dry-run syncs it was not very helpful for dry-runs. This change
makes the output much more compact and readable with many commands and
hosts.
// Instead, quiet shows them only when they produce output (e.g.
// `ainsl`, `rm -v`) and thus modify the host's state.
var noOutput int
// Instead, quiet shows them only when they produce output (e.g.
// `ainsl`, `rm -v`) and thus modify the host's state.
var noOutput int
- if s.config.Quiet && !s.config.DryRun {
for _, x := range changes {
if x.Trigger == "" &&
x.Error == "" &&
for _, x := range changes {
if x.Trigger == "" &&
x.Error == "" &&
var buf strings.Builder
fmt.Fprintf(&buf, "executed %d command(s)", len(changes))
var buf strings.Builder
fmt.Fprintf(&buf, "executed %d command(s)", len(changes))
+ if noOutput > 0 && !s.config.DryRun {
fmt.Fprintf(&buf, ", %d with no output", noOutput)
}
if noOutput != len(changes) {
fmt.Fprintf(&buf, ", %d with no output", noOutput)
}
if noOutput != len(changes) {
Command: "fake failed command",
},
},
Command: "fake failed command",
},
},
- `executed 5 command(s): (dry-run)
-"fake command"
-"fake command with no output"
-"fake command with newline"
-"fake command with more output"
-"fake failed command"
+ `executed 5 command(s) (dry-run)