mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-26 18:30:30 +00:00
34 lines
522 B
Go
34 lines
522 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"log"
|
||
|
|
||
|
"github.com/codegangsta/cli"
|
||
|
)
|
||
|
|
||
|
var secretRemoveCmd = cli.Command{
|
||
|
Name: "rm",
|
||
|
Usage: "remove a secret",
|
||
|
Action: func(c *cli.Context) {
|
||
|
if err := secretRemove(c); err != nil {
|
||
|
log.Fatalln(err)
|
||
|
}
|
||
|
},
|
||
|
}
|
||
|
|
||
|
func secretRemove(c *cli.Context) error {
|
||
|
repo := c.Args().First()
|
||
|
owner, name, err := parseRepo(repo)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
secret := c.Args().Get(1)
|
||
|
|
||
|
client, err := newClient(c)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return client.SecretDel(owner, name, secret)
|
||
|
}
|