1
0
mirror of https://github.com/drone/drone-cli.git synced 2025-04-30 21:28:03 +02:00
drone-cli/drone/enable.go
2015-02-13 00:23:01 -08:00

31 lines
646 B
Go

package main
import (
"github.com/codegangsta/cli"
"github.com/drone/drone-go/drone"
)
// 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.
func enableCommandFunc(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.Enable(host, owner, name)
}