1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-12-12 08:23:48 +02:00
woodpecker/cmd/disable.go

31 lines
655 B
Go
Raw Normal View History

2014-07-16 10:34:23 +03:00
package main
import (
"github.com/codegangsta/cli"
2014-08-10 02:51:08 +03:00
"github.com/drone/drone/client"
2014-07-16 10:34:23 +03: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-10 02:51:08 +03:00
func disableCommandFunc(c *cli.Context, client *client.Client) error {
var host, owner, name string
var args = c.Args()
2014-07-16 10:34:23 +03:00
2014-08-10 02:51:08 +03:00
if len(args) != 0 {
host, owner, name = parseRepo(args[0])
2014-07-16 10:34:23 +03:00
}
2014-08-10 02:51:08 +03:00
return client.Repos.Disable(host, owner, name)
2014-07-16 10:34:23 +03:00
}