Skip to content

Commit

Permalink
cli: nicer output
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Meyer <[email protected]>
  • Loading branch information
katexochen committed Mar 7, 2024
1 parent c5f28b1 commit 7f2a0c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cli/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func runGenerate(cmd *cobra.Command, args []string) error {
if err := generatePolicies(cmd.Context(), flags.policyPath, flags.settingsPath, paths, log); err != nil {
return fmt.Errorf("failed to generate policies: %w", err)
}
fmt.Fprintln(cmd.OutOrStdout(), "✔️ Generated workload policy annotations")

policies, err := policiesFromKubeResources(paths)
if err != nil {
Expand Down Expand Up @@ -132,7 +133,7 @@ func runGenerate(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to write manifest: %w", err)
}

log.Info("Updated manifest", "path", flags.manifestPath)
fmt.Fprintf(cmd.OutOrStdout(), "✔️ Updated manifest %s\n", flags.manifestPath)

if hash := getCoordinatorPolicyHash(policies, log); hash != "" {
if err := os.WriteFile(coordHashFilename, []byte(hash), 0o644); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ func runSet(cmd *cobra.Command, args []string) error {
fmt.Fprintln(cmd.OutOrStdout(), msg)
}
}
return fmt.Errorf("failed to set manifest: %w", err)
return fmt.Errorf("setting manifest: %w", err)
}

fmt.Fprintln(cmd.OutOrStdout(), "Manifest set successfully")
fmt.Fprintln(cmd.OutOrStdout(), "✔️ Manifest set successfully")

filelist := map[string][]byte{
coordRootPEMFilename: resp.CACert,
Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func runVerify(cmd *cobra.Command, _ []string) error {
return fmt.Errorf("writing filelist: %w", err)
}

fmt.Fprintln(cmd.OutOrStdout(), "Successfully verified coordinator")
fmt.Fprintln(cmd.OutOrStdout(), "✔️ Successfully verified coordinator")

return nil
}
Expand Down

0 comments on commit 7f2a0c6

Please sign in to comment.