X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_sync.go;h=01e712c50f552d8296491c2a3ea515432ff46006;hb=cd7436284aa538d6a8a83811a33b3a3cc32d87a3;hp=0d5a722d9ef59b0461550532adcef372725db767;hpb=0d6364c68d5e523f3c69b93d48cadfb7c150b652;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_sync.go b/cmd/safcm/sync_sync.go index 0d5a722..01e712c 100644 --- a/cmd/safcm/sync_sync.go +++ b/cmd/safcm/sync_sync.go @@ -21,12 +21,12 @@ import ( "fmt" "math" "os" - "path/filepath" "sort" "strings" "ruderich.org/simon/safcm" "ruderich.org/simon/safcm/cmd/safcm/config" + "ruderich.org/simon/safcm/frontend" "ruderich.org/simon/safcm/rpc" ) @@ -35,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) } @@ -255,7 +256,8 @@ func resolveFileDirConflicts(files map[string]*safcm.File) { return paths[i] < paths[j] }) - const sep = string(filepath.Separator) + // Slash separated paths are used for the configuration + const sep = "/" // Remove invalid paths which can result from group_priority // overriding paths from another group (e.g. "/foo" as file from one