File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 4
4
"github.com/spf13/cobra"
5
5
"golang.org/x/xerrors"
6
6
7
+ "github.com/coder/coder/cli/cliui"
7
8
"github.com/coder/coder/codersdk"
8
9
)
9
10
@@ -14,14 +15,23 @@ func rename() *cobra.Command {
14
15
Short : "Rename a workspace" ,
15
16
Args : cobra .ExactArgs (2 ),
16
17
RunE : func (cmd * cobra.Command , args []string ) error {
17
- client , err := createClient (cmd )
18
+ client , err := CreateClient (cmd )
18
19
if err != nil {
19
20
return err
20
21
}
21
22
workspace , err := namedWorkspace (cmd , client , args [0 ])
22
23
if err != nil {
23
24
return xerrors .Errorf ("get workspace: %w" , err )
24
25
}
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
+
25
35
err = client .UpdateWorkspace (cmd .Context (), workspace .ID , codersdk.UpdateWorkspaceRequest {
26
36
Name : args [1 ],
27
37
})
You can’t perform that action at this time.
0 commit comments