1
0
mirror of https://github.com/drone/drone-cli.git synced 2024-11-23 01:11:57 +01:00

feat(cron): add rm command

Signed-off-by: Javier Palomo <javier.palomo@grafana.com>
This commit is contained in:
Javier Palomo 2021-03-10 11:48:44 +01:00 committed by TP Honey
parent c0d062982c
commit 3e2bf56d5e
2 changed files with 29 additions and 0 deletions

@ -10,6 +10,7 @@ var Command = cli.Command{
cronListCmd,
cronInfoCmd,
cronCreateCmd,
cronDeleteCmd,
cronDisableCmd,
cronEnableCmd,
},

28
drone/cron/cron_rm.go Normal file

@ -0,0 +1,28 @@
package cron
import (
"github.com/drone/drone-cli/drone/internal"
"github.com/urfave/cli"
)
var cronDeleteCmd = cli.Command{
Name: "rm",
Usage: "deletes a cronjob",
ArgsUsage: "[repo/name] [cronjob]",
Action: cronDelete,
}
func cronDelete(c *cli.Context) error {
slug := c.Args().First()
owner, name, err := internal.ParseRepo(slug)
if err != nil {
return err
}
client, err := internal.NewClient(c)
if err != nil {
return err
}
cron := c.Args().Get(1)
client.CronDelete(owner, name, cron)
return client.CronDelete(owner, name, cron)
}