Skip to content

Commit 77e8499

Browse files
author
Yago Carlos Fernandez Gou
committed
Address feedback - spinner not stopped
1 parent e414299 commit 77e8499

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

internal/cmd/beta/intake/user/create/create.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ func NewCmd(p *types.CmdParams) *cobra.Command {
8888

8989
// Wait for async operation, if async mode not enabled
9090
if !model.Async {
91-
s := spinner.New(p.Printer)
92-
s.Start("Creating STACKIT Intake User")
93-
_, err = wait.CreateOrUpdateIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, *model.IntakeId, resp.GetId()).WaitWithContext(ctx)
91+
err := spinner.Run(p.Printer, "Creating STACKIT Intake User", func() error {
92+
_, err = wait.CreateOrUpdateIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, *model.IntakeId, resp.GetId()).WaitWithContext(ctx)
93+
return err
94+
})
9495
if err != nil {
9596
return fmt.Errorf("wait for STACKIT Intake User creation: %w", err)
9697
}
97-
s.Stop()
9898
}
9999

100100
return outputResult(p.Printer, model, projectLabel, resp)

internal/cmd/beta/intake/user/delete/delete.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ func NewCmd(p *types.CmdParams) *cobra.Command {
7070

7171
// Wait for async operation, if async mode not enabled
7272
if !model.Async {
73-
s := spinner.New(p.Printer)
74-
s.Start("Deleting STACKIT Intake User")
75-
_, err = wait.DeleteIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, model.IntakeId, model.UserId).WaitWithContext(ctx)
73+
err := spinner.Run(p.Printer, "Deleting STACKIT Intake User", func() error {
74+
_, err = wait.DeleteIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, model.IntakeId, model.UserId).WaitWithContext(ctx)
75+
return err
76+
})
7677
if err != nil {
7778
return fmt.Errorf("wait for STACKIT Intake User deletion: %w", err)
7879
}
79-
s.Stop()
8080
}
8181

8282
operationState := "Deleted"

internal/cmd/beta/intake/user/update/update.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,14 @@ func NewCmd(p *types.CmdParams) *cobra.Command {
7777

7878
// Wait for async operation, if async mode not enabled
7979
if !model.Async {
80-
s := spinner.New(p.Printer)
81-
s.Start("Updating STACKIT Intake User")
82-
_, err = wait.CreateOrUpdateIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, model.IntakeId, model.UserId).WaitWithContext(ctx)
80+
err := spinner.Run(p.Printer, "Updating STACKIT Intake User", func() error {
81+
_, err = wait.CreateOrUpdateIntakeUserWaitHandler(ctx, apiClient, model.ProjectId, model.Region, model.IntakeId, model.UserId).WaitWithContext(ctx)
82+
return err
83+
})
84+
8385
if err != nil {
8486
return fmt.Errorf("wait for STACKIT Intake User update: %w", err)
8587
}
86-
s.Stop()
8788
}
8889

8990
return outputResult(p.Printer, model, resp)

0 commit comments

Comments
 (0)