mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 08:23:48 +02:00
31 lines
645 B
Go
31 lines
645 B
Go
package main
|
|
|
|
import (
|
|
"github.com/codegangsta/cli"
|
|
"github.com/drone/drone/client"
|
|
)
|
|
|
|
// 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 *client.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)
|
|
}
|