1
0
mirror of https://github.com/drone/drone-cli.git synced 2026-01-16 16:01:35 +01:00
drone-cli/drone/delete.go

31 lines
646 B
Go
Raw Normal View History

2015-02-13 09:23:01 +01:00
package main
import (
"github.com/codegangsta/cli"
"github.com/drone/drone-go/drone"
)
// NewDeleteCommand returns the CLI command for "delete".
func NewDeleteCommand() cli.Command {
return cli.Command{
Name: "delete",
Usage: "delete a repository",
Flags: []cli.Flag{},
Action: func(c *cli.Context) {
handle(c, deleteCommandFunc)
},
}
}
// deleteCommandFunc executes the "delete" command.
func deleteCommandFunc(c *cli.Context, client *drone.Client) error {
var host, owner, name string
var args = c.Args()
if len(args) != 0 {
host, owner, name = parseRepo(args[0])
}
return client.Repos.Delete(host, owner, name)
}