]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync_sync.go
Update copyright years
[safcm/safcm.git] / cmd / safcm / sync_sync.go
index 3f0c30b0e88e88baa2044212ce0c84646b692ea9..eeb387095d59999dc6da2eaff1118ccd6d7581c2 100644 (file)
@@ -1,6 +1,6 @@
 // "sync" sub-command: sync files
 
-// Copyright (C) 2021  Simon Ruderich
+// Copyright (C) 2021-2022  Simon Ruderich
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -26,6 +26,7 @@ import (
 
        "ruderich.org/simon/safcm"
        "ruderich.org/simon/safcm/cmd/safcm/config"
+       "ruderich.org/simon/safcm/frontend"
        "ruderich.org/simon/safcm/rpc"
 )
 
@@ -34,17 +35,18 @@ func (s *Sync) hostSync(conn *rpc.Conn, detectedGroups []string) error {
        if err != nil {
                return err
        }
-       x, err := s.sendRecv(conn, req)
+       resp, err := s.loop.HostSyncMsg(s, conn, req)
        if err != nil {
                return err
        }
-       resp, ok := x.(safcm.MsgSyncResp)
-       if !ok {
-               return fmt.Errorf("unexpected response %v", x)
-       }
 
        // Display changes
-       changes := s.formatChanges(resp)
+       c := frontend.Changes{
+               DryRun: s.config.DryRun,
+               Quiet:  s.config.Quiet,
+               IsTTY:  s.isTTY,
+       }
+       changes := c.FormatChanges(resp)
        if changes != "" {
                s.log(safcm.LogInfo, true, changes)
        }