harness-drone/drone/org_secret_list.go

33 lines
525 B
Go
Raw Normal View History

2016-07-31 20:09:55 +00:00
package main
2017-03-16 10:14:02 +00:00
import "github.com/urfave/cli"
2016-07-31 20:09:55 +00:00
var orgSecretListCmd = cli.Command{
2017-03-16 10:14:02 +00:00
Name: "ls",
Usage: "list all secrets",
Action: orgSecretList,
Flags: secretListFlags(),
2016-07-31 20:09:55 +00:00
}
func orgSecretList(c *cli.Context) error {
2016-08-14 22:02:11 +00:00
if len(c.Args()) != 1 {
2016-07-31 20:09:55 +00:00
cli.ShowSubcommandHelp(c)
return nil
}
team := c.Args().First()
client, err := newClient(c)
if err != nil {
return err
}
secrets, err := client.TeamSecretList(team)
if err != nil || len(secrets) == 0 {
return err
}
2016-10-20 00:13:21 +00:00
return secretDisplayList(secrets, c)
2016-07-31 20:09:55 +00:00
}