harness-drone/cmd/enable.go

31 lines
645 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
)
// NewEnableCommand returns the CLI command for "enable".
func NewEnableCommand() cli.Command {
return cli.Command{
Name: "enable",
Usage: "enable a repository",
Flags: []cli.Flag{},
Action: func(c *cli.Context) {
handle(c, enableCommandFunc)
},
}
}
// enableCommandFunc executes the "enable" command.
2014-08-09 23:51:08 +00:00
func enableCommandFunc(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.Enable(host, owner, name)
2014-07-16 07:34:23 +00:00
}