// the remote helper is untrusted and must be either escaped with %q or by
// calling EscapeControlCharacters().
+func (s *Sync) formatChanges(resp safcm.MsgSyncResp) string {
+ var changes []string
+ if len(resp.FileChanges) > 0 {
+ changes = append(changes,
+ s.formatFileChanges(resp.FileChanges))
+ }
+ if len(resp.PackageChanges) > 0 {
+ changes = append(changes,
+ s.formatPackageChanges(resp.PackageChanges))
+ }
+ if len(resp.ServiceChanges) > 0 {
+ changes = append(changes,
+ s.formatServiceChanges(resp.ServiceChanges))
+ }
+ if len(resp.CommandChanges) > 0 {
+ changes = append(changes,
+ s.formatCommandChanges(resp.CommandChanges))
+ }
+ if len(changes) == 0 {
+ return ""
+ }
+ return "\n" + strings.Join(changes, "\n")
+}
+
func (s *Sync) formatFileChanges(changes []safcm.FileChange) string {
var buf strings.Builder
fmt.Fprintf(&buf, "changed %d file(s):", len(changes))