diff --git a/command/clearEstimate.go b/command/clearEstimate.go index 063695c..9e188ef 100644 --- a/command/clearEstimate.go +++ b/command/clearEstimate.go @@ -10,6 +10,7 @@ func CmdClearEstimate(c *cli.Context) { issueNumer, err := strconv.Atoi(c.Args().Get(0)) if err != nil { cli.ShowCommandHelp(c, "clearEstimate") + os.Exit(1) } client := NewZenhubClient(c) diff --git a/command/estimate.go b/command/estimate.go index 84c73c2..d60232f 100644 --- a/command/estimate.go +++ b/command/estimate.go @@ -10,10 +10,12 @@ func CmdEstimate(c *cli.Context) { issueNumer, err := strconv.Atoi(c.Args().Get(0)) if err != nil { cli.ShowCommandHelp(c, "estimate") + os.Exit(1) } estimateValue, err := strconv.Atoi(c.Args().Get(1)) if err != nil { cli.ShowCommandHelp(c, "estimate") + os.Exit(1) } client := NewZenhubClient(c) diff --git a/command/issue.go b/command/issue.go index 05f257f..cb513e7 100644 --- a/command/issue.go +++ b/command/issue.go @@ -3,6 +3,7 @@ package command import ( "encoding/json" "fmt" + "os" "github.com/codegangsta/cli" zenhub "github.com/cou929/zenhub-client" "strconv" @@ -30,6 +31,7 @@ func CmdIssue(c *cli.Context) { issueNumber, err := strconv.Atoi(c.Args().Get(0)) if err != nil { cli.ShowCommandHelp(c, "issue") + os.Exit(1) } client := NewZenhubClient(c) @@ -56,12 +58,21 @@ func CmdIssue(c *cli.Context) { result := map[string]interface{}{ "issueNumber": issueNumber, - "pipelineId": pipeline.Id, - "pipelineName": pipeline.Name, - "estimateValue": estimate.Value, + "pipelineId": nil, + "pipelineName": nil, + "estimateValue": nil, "pluses": pluses, } + if pipeline != nil { + result["pipelineId"] = pipeline.Id + result["pipelineName"] = pipeline.Name + } + + if estimate != nil { + result["estimateValue"] = estimate.Value + } + marshaled, err := json.Marshal(result) DieIfError(err) diff --git a/command/transfer.go b/command/transfer.go index d9f6ae7..f37d214 100644 --- a/command/transfer.go +++ b/command/transfer.go @@ -10,10 +10,12 @@ func CmdTransfer(c *cli.Context) { issueNumer, err := strconv.Atoi(c.Args().Get(0)) if err != nil { cli.ShowCommandHelp(c, "transfer") + os.Exit(1) } pipelineName := c.Args().Get(1) if pipelineName == "" { cli.ShowCommandHelp(c, "transfer") + os.Exit(1) } client := NewZenhubClient(c) diff --git a/version.go b/version.go index 4ca932c..c716b7c 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package main const Name string = "zhb" -const Version string = "0.1.2" +const Version string = "0.1.3" diff --git a/wercker.yml b/wercker.yml index 5beabd3..f3ec4f6 100644 --- a/wercker.yml +++ b/wercker.yml @@ -29,5 +29,5 @@ deploy: - tcnksm/ghr: token: $GITHUB_TOKEN input: dist - version: v0.1.2 + version: v0.1.3 replace: true