Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commit03d2d8b

Browse files
authored
Unhide coder envs rm command (#162)
1 parentcd50b33 commit03d2d8b

File tree

5 files changed

+39
-23
lines changed

5 files changed

+39
-23
lines changed

‎docs/coder_envs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Perform operations on the Coder environments owned by the active user.
2424
*[coder](coder.md) - coder provides a CLI for working with an existing Coder Enterprise installation
2525
*[coder envs ls](coder_envs_ls.md) - list all environments owned by the active user
2626
*[coder envs rebuild](coder_envs_rebuild.md) - rebuild a Coder environment
27+
*[coder envs rm](coder_envs_rm.md) - remove Coder environments by name
2728
*[coder envs stop](coder_envs_stop.md) - stop Coder environments by name
2829
*[coder envs watch-build](coder_envs_watch-build.md) - trail the build log of a Coder environment
2930

‎docs/coder_envs_rm.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
##coder envs rm
2+
3+
remove Coder environments by name
4+
5+
```
6+
coder envs rm [...environment_names] [flags]
7+
```
8+
9+
###Options
10+
11+
```
12+
-f, --force force remove the specified environments without prompting first
13+
-h, --help help for rm
14+
```
15+
16+
###Options inherited from parent commands
17+
18+
```
19+
--user string Specify the user whose resources to target (default "me")
20+
-v, --verbose show verbose output
21+
```
22+
23+
###SEE ALSO
24+
25+
*[coder envs](coder_envs.md) - Interact with Coder environments
26+

‎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-
funcWarn(headerstring,lines...string)CLIError {
83-
returnCLIError{
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
funcError(headerstring,lines...string)CLIError {
9683
returnCLIError{

‎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
iferr!=nil {
36-
returnnil,xerrors.Errorf("urlmisformatted: %w try runing\"coder login\" with a valid URL",err)
36+
returnnil,xerrors.Errorf("urlmalformed: %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
returnc,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 youwan't the environment to be based off of.")
330-
cmd.Flags().StringVarP(&tag,"tag","t","latest","image tag of the image youwan't to base the environment off of.")
329+
cmd.Flags().StringVarP(&img,"image","i","","name of the image youwant the environment to be based off of.")
330+
cmd.Flags().StringVarP(&tag,"tag","t","latest","image tag of the image youwant 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
funcrmEnvsCommand(user*string)*cobra.Command {
340340
varforcebool
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-
returnerr
357+
returnclog.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)

[8]ページ先頭

©2009-2025 Movatter.jp