2016-05-06 17:59:36 +00:00
|
|
|
package main
|
|
|
|
|
2017-03-16 10:14:02 +00:00
|
|
|
import "github.com/urfave/cli"
|
2016-05-06 17:59:36 +00:00
|
|
|
|
2017-04-11 17:06:45 +00:00
|
|
|
var secretDeleteCmd = cli.Command{
|
2017-03-16 10:14:02 +00:00
|
|
|
Name: "rm",
|
|
|
|
Usage: "remove a secret",
|
2017-04-11 17:06:45 +00:00
|
|
|
Action: secretDelete,
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "repository",
|
|
|
|
Usage: "repository name (e.g. octocat/hello-world)",
|
|
|
|
},
|
|
|
|
cli.StringFlag{
|
|
|
|
Name: "name",
|
|
|
|
Usage: "secret name",
|
|
|
|
},
|
|
|
|
},
|
2016-05-06 17:59:36 +00:00
|
|
|
}
|
|
|
|
|
2017-04-11 17:06:45 +00:00
|
|
|
func secretDelete(c *cli.Context) error {
|
|
|
|
var (
|
|
|
|
secret = c.String("name")
|
|
|
|
reponame = c.String("repository")
|
|
|
|
)
|
|
|
|
if reponame == "" {
|
|
|
|
reponame = c.Args().First()
|
|
|
|
}
|
|
|
|
owner, name, err := parseRepo(reponame)
|
2016-05-06 17:59:36 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
client, err := newClient(c)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-04-11 17:06:45 +00:00
|
|
|
return client.SecretDelete(owner, name, secret)
|
2016-05-06 17:59:36 +00:00
|
|
|
}
|