fixed restart client

This commit is contained in:
Brad Rydzewski 2014-08-14 12:36:04 -07:00
parent 4215193af9
commit 1dec169812
2 changed files with 11 additions and 8 deletions

View file

@ -31,7 +31,7 @@ func (s *CommitService) GetOutput(host, owner, name, branch, sha string) (io.Rea
// POST /v1/repos/{host}/{owner}/{name}/branches/{branch}/commits/{commit}?action=rebuild
func (s *CommitService) Rebuild(host, owner, name, branch, sha string) error {
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s", host, owner, name, branch, sha)
var path = fmt.Sprintf("/v1/repos/%s/%s/%s/branches/%s/commits/%s?action=rebuild", host, owner, name, branch, sha)
return s.run("POST", path, nil, nil)
}

View file

@ -22,14 +22,17 @@ func restartCommandFunc(c *cli.Context, client *client.Client) error {
var host, owner, repo, branch, sha string
var args = c.Args()
if len(args) == 5 {
if len(args) != 0 {
host, owner, repo = parseRepo(args[0])
} else {
host = "unknown"
owner = "unknown"
repo = "unknown"
branch = "unknown"
sha = "unknown"
}
switch len(args) {
case 2:
branch = "master"
sha = args[1]
case 3,4,5:
branch = args[1]
sha = args[2]
}
return client.Commits.Rebuild(host, owner, repo, branch, sha)