X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_changes.go;h=a85b8100946da96a6bf2670a2a4f0d32917eba2e;hb=9a448e1f88dbc2b0857bd984089c99905c092633;hp=6327fd9addbaec497a31452a635082cb6f65b32e;hpb=cfcc39441d8e9b1f003b8d5c02240e7186bfc2d1;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_changes.go b/cmd/safcm/sync_changes.go index 6327fd9..a85b810 100644 --- a/cmd/safcm/sync_changes.go +++ b/cmd/safcm/sync_changes.go @@ -51,7 +51,16 @@ func (s *Sync) formatChanges(resp safcm.MsgSyncResp) string { if len(changes) == 0 { return "" } - return "\n" + strings.Join(changes, "\n") + + x := strings.Join(changes, "\n") + // If quiet is used and only commands without output were executed + // then don't prepend a newline so that the whole change output of a + // host fits in a single line. This makes the output much more + // readable with multiple hosts. + if strings.Count(x, "\n") == 1 { + return x + } + return "\n" + x } func (s *Sync) formatFileChanges(changes []safcm.FileChange) string {