diff --git a/internal/command/plan/compile.go b/internal/command/plan/compile.go index d0acf47..a67e298 100644 --- a/internal/command/plan/compile.go +++ b/internal/command/plan/compile.go @@ -66,7 +66,9 @@ func compile(cfg *config.PlanCompile, out, log io.Writer) error { if _, err := plantag.ApplyTag(cfg.Plan, resp.Payload.ID, cfg.Tag); err != nil { return fmt.Errorf("plan compiled (id=%s) but tagging failed: %w", resp.Payload.ID, err) } - fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + if cfg.OutputFormat == config.OutputFormatDefault { + fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + } } switch cfg.OutputFormat { diff --git a/internal/command/plan/create.go b/internal/command/plan/create.go index 56fa17d..37d6df0 100644 --- a/internal/command/plan/create.go +++ b/internal/command/plan/create.go @@ -54,7 +54,9 @@ func create(cfg *config.PlanCreate, out, log io.Writer) error { if _, err := plantag.ApplyTag(cfg.Plan, resp.Payload.ID, cfg.Tag); err != nil { return fmt.Errorf("plan created (id=%s) but tagging failed: %w", resp.Payload.ID, err) } - fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + if cfg.OutputFormat == config.OutputFormatDefault { + fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + } } switch cfg.OutputFormat { diff --git a/internal/command/plan/recompile.go b/internal/command/plan/recompile.go index 3131da6..3799d79 100644 --- a/internal/command/plan/recompile.go +++ b/internal/command/plan/recompile.go @@ -44,7 +44,9 @@ func recompile(cfg *config.PlanRecompile, out, log io.Writer, planID string) err if _, err := plantag.ApplyTag(cfg.Plan, resp.Payload.ID, cfg.Tag); err != nil { return fmt.Errorf("plan recompiled (id=%s) but tagging failed: %w", resp.Payload.ID, err) } - fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + if cfg.OutputFormat == config.OutputFormatDefault { + fmt.Fprintf(log, "Tagged plan %s as %q\n", resp.Payload.ID, cfg.Tag) + } } switch cfg.OutputFormat { diff --git a/internal/command/plan/run.go b/internal/command/plan/run.go index cf15bbc..6096ffa 100644 --- a/internal/command/plan/run.go +++ b/internal/command/plan/run.go @@ -82,7 +82,9 @@ func runPlan(cfg *config.PlanRun, out, log io.Writer, args []string) error { return fmt.Errorf("creating execution: %w", err) } execID := createResp.Payload.ID - fmt.Fprintf(log, "Created execution %s for plan %s\n", execID, planID) + if cfg.OutputFormat == config.OutputFormatDefault { + fmt.Fprintf(log, "Created execution %s for plan %s\n", execID, planID) + } // Fire-and-forget mode. if !cfg.Wait { @@ -229,7 +231,11 @@ func pollExecution(ctx context.Context, cfg *config.PlanRun, log io.Writer, exec defer cancel() } - spin := spinner.Start(log, "Execution") + spinWriter := log + if cfg.OutputFormat != config.OutputFormatDefault { + spinWriter = io.Discard + } + spin := spinner.Start(spinWriter, "Execution") defer spin.Stop() ticker := time.NewTicker(2 * time.Second)