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

Commit 748409e

Browse files
committed
More improvements
1 parent e1d9568 commit 748409e

File tree

3 files changed

+29
-17
lines changed

3 files changed

+29
-17
lines changed

cmd/coder/main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ func main() {
3535
app.Name = "coder"
3636
app.Usage = "coder provides a CLI for working with an existing Coder Enterprise installation"
3737
app.Version = fmt.Sprintf("%s %s %s/%s", version, runtime.Version(), runtime.GOOS, runtime.GOARCH)
38+
app.Author = "Coder Technologies Inc."
39+
app.CommandNotFound = func(c *cli.Context, s string) {
40+
flog.Fatal("command %q not found", s)
41+
}
42+
app.Email = "support@coder.com"
43+
3844
app.Commands = []cli.Command{
3945
makeLoginCmd(),
4046
makeLogoutCmd(),

cmd/coder/secrets.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func makeSecretsCmd() cli.Command {
2828
makeCreateSecret(),
2929
{
3030
Name: "rm",
31-
Usage: "Remove a secret by name",
32-
ArgsUsage: "[secret_name]",
31+
Usage: "Remove one or more secrets by name",
32+
ArgsUsage: "[...secret_name]",
3333
Action: removeSecret,
3434
},
3535
{
@@ -175,14 +175,23 @@ func viewSecret(c *cli.Context) {
175175
func removeSecret(c *cli.Context) {
176176
var (
177177
client = requireAuth()
178-
name = c.Args().First()
178+
names = append([]string{c.Args().First()}, c.Args().Tail()...)
179179
)
180-
if name == "" {
181-
flog.Fatal("[name] is a required argument")
180+
if len(names) < 1 || names[0] == "" {
181+
flog.Fatal("[...secret_name] is a required argument")
182182
}
183183

184-
err := client.DeleteSecretByName(name)
185-
requireSuccess(err, "failed to delete secret: %v", err)
186-
187-
flog.Info("Successfully deleted secret %q", name)
184+
errorSeen := false
185+
for _, n := range names {
186+
err := client.DeleteSecretByName(n)
187+
if err != nil {
188+
flog.Error("failed to delete secret: %v", err)
189+
errorSeen = true
190+
} else {
191+
flog.Info("Successfully deleted secret %q", n)
192+
}
193+
}
194+
if errorSeen {
195+
os.Exit(1)
196+
}
188197
}

cmd/coder/users.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ import (
1414
func makeUsersCmd() cli.Command {
1515
var output string
1616
return cli.Command{
17-
Name: "users",
18-
Usage: "Interact with Coder user accounts",
19-
ArgsUsage: "[subcommand] <flags>",
17+
Name: "users",
18+
Usage: "Interact with Coder user accounts",
2019
Subcommands: []cli.Command{
2120
{
22-
Name: "ls",
23-
Usage: "list all user accounts",
24-
Description: "",
25-
Action: listUsers(&output),
21+
Name: "ls",
22+
Usage: "list all user accounts",
23+
Action: listUsers(&output),
2624
Flags: []cli.Flag{
2725
cli.StringFlag{
2826
Name: "output",
2927
Usage: "(json | human)",
30-
Required: false,
3128
Value: "human",
3229
Destination: &output,
3330
},

0 commit comments

Comments
 (0)