Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit a7d0320

Browse files
committed
Unhide coder envs rm command
1 parent cd50b33 commit a7d0320

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

internal/clog/error.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,6 @@ func LogWarn(header string, lines ...string) {
7878
}.String())
7979
}
8080

81-
// Warn creates an error with the level "warning".
82-
func Warn(header string, lines ...string) CLIError {
83-
return CLIError{
84-
CLIMessage: CLIMessage{
85-
Color: color.FgYellow,
86-
Level: "warning",
87-
Header: header,
88-
Lines: lines,
89-
},
90-
error: errors.New(header),
91-
}
92-
}
93-
9481
// Error creates an error with the level "error".
9582
func Error(header string, lines ...string) CLIError {
9683
return CLIError{

internal/cmd/auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func newClient() (*coder.Client, error) {
3333

3434
u, err := url.Parse(rawURL)
3535
if err != nil {
36-
return nil, xerrors.Errorf("url misformatted: %w try runing \"coder login\" with a valid URL", err)
36+
return nil, xerrors.Errorf("url malformed: %w try runing \"coder login\" with a valid URL", err)
3737
}
3838

3939
c := &coder.Client{
@@ -54,12 +54,12 @@ func newClient() (*coder.Client, error) {
5454
}
5555

5656
if !version.VersionsMatch(apiVersion) {
57-
clog.Log(clog.Warn(
57+
clog.LogWarn(
5858
"version mismatch detected",
5959
fmt.Sprintf("coder-cli version: %s", version.Version),
6060
fmt.Sprintf("Coder API version: %s", apiVersion), clog.BlankLine,
6161
clog.Tipf("download the appropriate version here: https://github.com/cdr/coder-cli/releases"),
62-
))
62+
)
6363
}
6464

6565
return c, nil

internal/cmd/envs.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ coder envs edit back-end-env --disk 20`,
326326
},
327327
}
328328
cmd.Flags().StringVarP(&org, "org", "o", "", "name of the organization the environment should be created under.")
329-
cmd.Flags().StringVarP(&img, "image", "i", "", "name of the image you wan't the environment to be based off of.")
330-
cmd.Flags().StringVarP(&tag, "tag", "t", "latest", "image tag of the image you wan't to base the environment off of.")
329+
cmd.Flags().StringVarP(&img, "image", "i", "", "name of the image you want the environment to be based off of.")
330+
cmd.Flags().StringVarP(&tag, "tag", "t", "latest", "image tag of the image you want to base the environment off of.")
331331
cmd.Flags().Float32P("cpu", "c", cpuCores, "The number of cpu cores the environment should be provisioned with.")
332332
cmd.Flags().Float32P("memory", "m", memGB, "The amount of RAM an environment should be provisioned with.")
333333
cmd.Flags().IntP("disk", "d", diskGB, "The amount of disk storage an environment should be provisioned with.")
@@ -339,10 +339,9 @@ coder envs edit back-end-env --disk 20`,
339339
func rmEnvsCommand(user *string) *cobra.Command {
340340
var force bool
341341
cmd := &cobra.Command{
342-
Use: "rm [...environment_names]",
343-
Short: "remove Coder environments by name",
344-
Hidden: true,
345-
Args: cobra.MinimumNArgs(1),
342+
Use: "rm [...environment_names]",
343+
Short: "remove Coder environments by name",
344+
Args: cobra.MinimumNArgs(1),
346345
RunE: func(cmd *cobra.Command, args []string) error {
347346
ctx := cmd.Context()
348347
client, err := newClient()
@@ -355,7 +354,10 @@ func rmEnvsCommand(user *string) *cobra.Command {
355354
IsConfirm: true,
356355
}
357356
if _, err := confirm.Run(); err != nil {
358-
return err
357+
return clog.Fatal(
358+
"failed to confirm prompt", clog.BlankLine,
359+
clog.Tipf(`use "--force" to rebuild without a confirmation prompt`),
360+
)
359361
}
360362
}
361363

0 commit comments

Comments
 (0)