Skip to content

Commit fb4152b

Browse files
committed
feat(credentials): code cleanup
1 parent 1f9bf58 commit fb4152b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

internal/cmd/beta/alb/credentials/update/update.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/stackitcloud/stackit-cli/internal/pkg/flags"
1313
"github.com/stackitcloud/stackit-cli/internal/pkg/globalflags"
1414
"github.com/stackitcloud/stackit-cli/internal/pkg/print"
15+
"github.com/stackitcloud/stackit-cli/internal/pkg/projectname"
1516
"github.com/stackitcloud/stackit-cli/internal/pkg/services/alb/client"
1617
"github.com/stackitcloud/stackit-cli/internal/pkg/utils"
1718
"golang.org/x/term"
@@ -70,8 +71,13 @@ func NewCmd(p *print.Printer) *cobra.Command {
7071
if err != nil {
7172
return err
7273
}
74+
projectLabel, err := projectname.GetProjectName(ctx, p, cmd)
75+
if err != nil {
76+
p.Debug(print.ErrorLevel, "get project name: %v", err)
77+
projectLabel = model.ProjectId
78+
}
7379
if !model.AssumeYes {
74-
prompt := fmt.Sprintf("Are you sure you want to update credential %q?", *model.CredentialsRef)
80+
prompt := fmt.Sprintf("Are you sure you want to update credential %q for %q?", *model.CredentialsRef, projectLabel)
7581
err = p.PromptForConfirmation(prompt)
7682
if err != nil {
7783
return fmt.Errorf("update credential: %w", err)

internal/cmd/beta/alb/delete/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewCmd(p *print.Printer) *cobra.Command {
5656
}
5757

5858
if !model.AssumeYes {
59-
prompt := fmt.Sprintf("Are you sure you want to delete the application loadbalancer %q for project %q?", model.Name, projectLabel)
59+
prompt := fmt.Sprintf("Are you sure you want to delete the credentials %q for project %q?", model.Name, projectLabel)
6060
err = p.PromptForConfirmation(prompt)
6161
if err != nil {
6262
return err

0 commit comments

Comments
 (0)