harness-drone/client/command/enable.go

35 lines
619 B
Go
Raw Normal View History

2014-07-16 07:34:23 +00:00
package main
import (
"github.com/codegangsta/cli"
)
// 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) error {
var repo string
var arg = c.Args()
if len(arg) != 0 {
repo = arg[0]
}
err := client.Do("POST", "/v1/repos/"+repo, nil, nil)
if err != nil {
return err
}
return nil
}