fix closing duplicate issue on dup command

This commit is contained in:
Cory Bennett
2017-08-13 21:10:23 -07:00
parent 36632a52f0
commit fc696c3323
9 changed files with 45 additions and 793 deletions
+8 -1
View File
@@ -1,6 +1,8 @@
package jiracli
import (
"fmt"
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
@@ -61,7 +63,12 @@ func (jc *JiraCli) CmdBlock(opts *BlockOptions) error {
Key: opts.Blocker,
}
return jc.LinkIssues(&opts.LinkIssueRequest)
if err := jc.LinkIssues(&opts.LinkIssueRequest); err != nil {
return err
}
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, jc.Endpoint, opts.Issue)
fmt.Printf("OK %s %s/browse/%s\n", opts.Blocker, jc.Endpoint, opts.Blocker)
// FIXME implement browse
+1 -2
View File
@@ -85,8 +85,7 @@ func (jc *JiraCli) CmdCreate(opts *CreateOptions) error {
return err
}
link := fmt.Sprintf("%s/browse/%s", jc.Endpoint, issueResp.Key)
fmt.Printf("OK %s %s\n", issueResp.Key, link)
fmt.Printf("OK %s %s/browse/%s\n", issueResp.Key, jc.Endpoint, issueResp.Key)
// FIXME implement browse
return nil
+27 -2
View File
@@ -1,6 +1,8 @@
package jiracli
import (
"fmt"
"gopkg.in/Netflix-Skunkworks/go-jira.v1/jiradata"
kingpin "gopkg.in/alecthomas/kingpin.v2"
)
@@ -61,9 +63,32 @@ func (jc *JiraCli) CmdDup(opts *DupOptions) error {
Key: opts.Issue,
}
return jc.LinkIssues(&opts.LinkIssueRequest)
if err := jc.LinkIssues(&opts.LinkIssueRequest); err != nil {
return err
}
fmt.Printf("OK %s %s/browse/%s\n", opts.Issue, jc.Endpoint, opts.Issue)
// FIXME need to close/done/start&stop dup issue
meta, err := jc.GetIssueTransitions(opts.Duplicate)
if err != nil {
return err
}
for _, trans := range []string{"close", "done", "start", "stop"} {
transMeta := meta.Transitions.Find(trans)
if transMeta != nil {
issueUpdate := jiradata.IssueUpdate{
Transition: transMeta,
}
if err = jc.TransitionIssue(opts.Duplicate, &issueUpdate); err != nil {
return err
}
// if we just started the issue now we need to stop it
if trans != "start" {
break
}
}
}
fmt.Printf("OK %s %s/browse/%s\n", opts.Duplicate, jc.Endpoint, opts.Duplicate)
// FIXME implement browse
+2 -2
View File
@@ -109,8 +109,8 @@ func (jc *JiraCli) CmdEdit(issue string, opts *EditOptions) error {
if err != nil {
return err
}
link := fmt.Sprintf("%s/browse/%s", jc.Endpoint, issueData.Key)
fmt.Printf("OK %s %s\n", issueData.Key, link)
fmt.Printf("OK %s %s/browse/%s\n", issueData.Key, jc.Endpoint, issueData.Key)
// FIXME implement browse
}
return nil
+1 -2
View File
@@ -101,8 +101,7 @@ func (jc *JiraCli) CmdSubtask(opts *SubtaskOptions) error {
return err
}
link := fmt.Sprintf("%s/browse/%s", jc.Endpoint, issueResp.Key)
fmt.Printf("OK %s %s\n", issueResp.Key, link)
fmt.Printf("OK %s %s/browse/%s\n", issueResp.Key, jc.Endpoint, issueResp.Key)
// FIXME implement browse
return nil
+2 -2
View File
@@ -123,8 +123,8 @@ func (jc *JiraCli) CmdTransition(opts *TransitionOptions) error {
if err != nil {
return err
}
link := fmt.Sprintf("%s/browse/%s", jc.Endpoint, issueData.Key)
fmt.Printf("OK %s %s\n", issueData.Key, link)
fmt.Printf("OK %s %s/browse/%s\n", issueData.Key, jc.Endpoint, issueData.Key)
// FIXME implement browse
return nil
}