]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync.go
safcm: move sync_changes.go and term.go to frontend package
[safcm/safcm.git] / cmd / safcm / sync.go
index 10edc68755e98c81e2c890745d3e3f706d3a3691..f1877cffde6b9b42b18955587192a19fda43127d 100644 (file)
@@ -214,11 +214,11 @@ are only available after the hosts were contacted.
 func logEvent(x frontend.Event, level safcm.LogLevel, isTTY bool, failed *bool) {
        // We have multiple event sources so this is somewhat ugly.
        var prefix, data string
-       var color Color
+       var color frontend.Color
        if x.Error != nil {
                prefix = "[error]"
                data = x.Error.Error()
-               color = ColorRed
+               color = frontend.ColorRed
                // We logged an error, tell the caller
                *failed = true
        } else if x.Log.Level != 0 {
@@ -237,7 +237,7 @@ func logEvent(x frontend.Event, level safcm.LogLevel, isTTY bool, failed *bool)
                        prefix = "[debug2]"
                default:
                        prefix = fmt.Sprintf("[INVALID=%d]", x.Log.Level)
-                       color = ColorRed
+                       color = frontend.ColorRed
                }
                data = x.Log.Text
        } else {
@@ -254,19 +254,19 @@ func logEvent(x frontend.Event, level safcm.LogLevel, isTTY bool, failed *bool)
                        x.ConnEvent.Data = "remote helper upload in progress"
                default:
                        prefix = fmt.Sprintf("[INVALID=%d]", x.ConnEvent.Type)
-                       color = ColorRed
+                       color = frontend.ColorRed
                }
                data = x.ConnEvent.Data
        }
 
        host := x.Host.Name()
        if color != 0 {
-               host = ColorString(isTTY, color, host)
+               host = frontend.ColorString(isTTY, color, host)
        }
        // Make sure to escape control characters to prevent terminal
        // injection attacks
        if !x.Escaped {
-               data = EscapeControlCharacters(isTTY, data)
+               data = frontend.EscapeControlCharacters(isTTY, data)
        }
        log.Printf("%-9s [%s] %s", prefix, host, data)
 }