Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion internal/command/plan/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion internal/command/plan/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion internal/command/plan/recompile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 8 additions & 2 deletions internal/command/plan/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down