woodpecker/cli/disable.go

31 lines
655 B
Go
Raw Normal View History

2014-07-16 07:34:23 +00:00
package main
import (
"github.com/codegangsta/cli"
2014-08-09 23:51:08 +00:00
"github.com/drone/drone/client"
2014-07-16 07:34:23 +00:00
)
// NewDisableCommand returns the CLI command for "disable".
func NewDisableCommand() cli.Command {
return cli.Command{
Name: "disable",
Usage: "disable a repository",
Flags: []cli.Flag{},
Action: func(c *cli.Context) {
handle(c, disableCommandFunc)
},
}
}
// disableCommandFunc executes the "disable" command.
2014-08-09 23:51:08 +00:00
func disableCommandFunc(c *cli.Context, client *client.Client) error {
var host, owner, name string
var args = c.Args()
2014-07-16 07:34:23 +00:00
2014-08-09 23:51:08 +00:00
if len(args) != 0 {
host, owner, name = parseRepo(args[0])
2014-07-16 07:34:23 +00:00
}
2014-08-09 23:51:08 +00:00
return client.Repos.Disable(host, owner, name)
2014-07-16 07:34:23 +00:00
}