This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-39
lines changed Expand file tree Collapse file tree 3 files changed +28
-39
lines changed Original file line number Diff line number Diff line change @@ -3,27 +3,31 @@ package main
3
3
import (
4
4
"fmt"
5
5
6
- "github.com/spf13/pflag"
7
-
8
- "go.coder.com/cli"
6
+ "github.com/urfave/cli"
9
7
)
10
8
11
- type envsCmd struct {
12
- }
13
-
14
- func (cmd envsCmd ) Spec () cli.CommandSpec {
15
- return cli.CommandSpec {
16
- Name : "envs" ,
17
- Desc : "get a list of environments owned by the authenticated user" ,
18
- }
19
- }
20
-
21
- func (cmd envsCmd ) Run (fl * pflag.FlagSet ) {
22
- entClient := requireAuth ()
23
-
24
- envs := getEnvs (entClient )
25
-
26
- for _ , env := range envs {
27
- fmt .Println (env .Name )
9
+ func makeEnvsCommand () cli.Command {
10
+ return cli.Command {
11
+ Name : "envs" ,
12
+ UsageText : "" ,
13
+ Description : "interact with Coder environments" ,
14
+ Subcommands : []cli.Command {
15
+ {
16
+ Name : "ls" ,
17
+ Usage : "list all environments owned by the active user" ,
18
+ UsageText : "" ,
19
+ Description : "" ,
20
+ ArgsUsage : "[...flags]>" ,
21
+ Action : func (c * cli.Context ) {
22
+ entClient := requireAuth ()
23
+ envs := getEnvs (entClient )
24
+
25
+ for _ , env := range envs {
26
+ fmt .Println (env .Name )
27
+ }
28
+ },
29
+ Flags : nil ,
30
+ },
31
+ },
28
32
}
29
33
}
Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ func (r *rootCmd) Spec() cdrcli.CommandSpec {
37
37
38
38
func (r * rootCmd ) Subcommands () []cdrcli.Command {
39
39
return []cdrcli.Command {
40
- & envsCmd {},
41
40
& syncCmd {},
42
41
& urlsCmd {},
43
42
}
@@ -67,6 +66,7 @@ func main() {
67
66
makeUsersCmd (),
68
67
makeConfigSSHCmd (),
69
68
makeSecretsCmd (),
69
+ makeEnvsCommand (),
70
70
}
71
71
err = app .Run (os .Args )
72
72
if err != nil {
Original file line number Diff line number Diff line change @@ -26,24 +26,9 @@ func makeShellCmd() cli.Command {
26
26
Description : "execute a remote command on the environment\\ nIf no command is specified, the default shell is opened." ,
27
27
SkipFlagParsing : true ,
28
28
SkipArgReorder : true ,
29
-
30
- ShortName : "" ,
31
- Aliases : nil ,
32
- UsageText : "" ,
33
- ArgsUsage : "" ,
34
- Category : "" ,
35
- BashComplete : nil ,
36
- Before : nil ,
37
- After : nil ,
38
- Action : shell ,
39
- OnUsageError : nil ,
40
- Subcommands : nil ,
41
- Flags : nil ,
42
- HideHelp : false ,
43
- Hidden : false ,
44
- UseShortOptionHandling : false ,
45
- HelpName : "" ,
46
- CustomHelpTemplate : "" ,
29
+ UsageText : "" ,
30
+ ArgsUsage : "" ,
31
+ Action : shell ,
47
32
}
48
33
}
49
34
You can’t perform that action at this time.
0 commit comments