Improve CLI sync messages

This commit is contained in:
Jesse Suen 2018-02-28 03:20:46 -08:00
parent a369d51a27
commit 155f608761
No known key found for this signature in database
GPG key ID: 90C911E8A6106562
2 changed files with 7 additions and 3 deletions

View file

@ -132,9 +132,12 @@ func NewApplicationListCommand() *cobra.Command {
defer util.Close(conn)
apps, err := appIf.List(context.Background(), &application.ApplicationQuery{})
errors.CheckError(err)
for _, c := range apps.Items {
fmt.Printf("%s\n", c.Name)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NAME\tCLUSTER\tNAMESPACE\tSTATUS\n")
for _, app := range apps.Items {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", app.Name, app.Status.ComparisonResult.Server, app.Status.ComparisonResult.Namespace, app.Status.ComparisonResult.Status)
}
_ = w.Flush()
},
}
return command

View file

@ -101,6 +101,7 @@ func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*Ap
}
var syncRes ApplicationSyncResult
switch app.Status.ComparisonResult.Status {
case appv1.ComparisonStatusEqual:
case appv1.ComparisonStatusDifferent:
default:
appState := app.Status.ComparisonResult.Status
@ -156,7 +157,7 @@ func (s *Server) Sync(ctx context.Context, syncReq *ApplicationSyncRequest) (*Ap
}
syncRes.Resources = append(syncRes.Resources, &resDetails)
}
syncRes.Message = "synced successful"
syncRes.Message = "successfully synced"
return &syncRes, nil
}