Skip to content

Commit f8dcf51

Browse files
committed
fix: Add data loss warning
1 parent 7ce1b3b commit f8dcf51

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cli/rename.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/spf13/cobra"
55
"golang.org/x/xerrors"
66

7+
"github.com/coder/coder/cli/cliui"
78
"github.com/coder/coder/codersdk"
89
)
910

@@ -14,14 +15,23 @@ func rename() *cobra.Command {
1415
Short: "Rename a workspace",
1516
Args: cobra.ExactArgs(2),
1617
RunE: func(cmd *cobra.Command, args []string) error {
17-
client, err := createClient(cmd)
18+
client, err := CreateClient(cmd)
1819
if err != nil {
1920
return err
2021
}
2122
workspace, err := namedWorkspace(cmd, client, args[0])
2223
if err != nil {
2324
return xerrors.Errorf("get workspace: %w", err)
2425
}
26+
27+
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
28+
Text: "WARNING: A rename can result in loss of home volume if the template references the workspace name. Continue?",
29+
IsConfirm: true,
30+
})
31+
if err != nil {
32+
return err
33+
}
34+
2535
err = client.UpdateWorkspace(cmd.Context(), workspace.ID, codersdk.UpdateWorkspaceRequest{
2636
Name: args[1],
2737
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy