harness-drone/drone/org_secret_list.go

41 lines
619 B
Go
Raw Normal View History

2016-07-31 20:09:55 +00:00
package main
import (
"log"
"github.com/codegangsta/cli"
)
var orgSecretListCmd = cli.Command{
Name: "ls",
Usage: "list all secrets",
Action: func(c *cli.Context) {
if err := orgSecretList(c); err != nil {
log.Fatalln(err)
}
},
2016-10-20 00:13:21 +00:00
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
}