Compare commits

..

3 Commits

Author SHA1 Message Date
Cory Bennett 37b138376b Updated Changelog 2017-05-10 09:05:30 -07:00
Cory Bennett 8a5e588ce2 fix unsafe casting for --quiet flag 2017-05-10 09:03:47 -07:00
Cory Bennett 67c86e4858 [#80] add jira unassign and jira give ISSUE --default commands 2017-05-10 08:58:53 -07:00
3 changed files with 49 additions and 20 deletions
+5
View File
@@ -1,5 +1,10 @@
# Changelog
## 0.1.14 - 2017-05-10
* fix unsafe casting for --quiet flag [Cory Bennett] [[6f29f43](https://github.com/Netflix-Skunkworks/go-jira/commit/6f29f43)]
* [[#80](https://github.com/Netflix-Skunkworks/go-jira/issues/80)] add `jira unassign` and `jira give ISSUE --default` commands [Cory Bennett] [[03d8633](https://github.com/Netflix-Skunkworks/go-jira/commit/03d8633)]
## 0.1.13 - 2017-04-24
* work around `github.com/tmc/keyring` compile error for windows [Cory Bennett] [[85298e9](https://github.com/Netflix-Skunkworks/go-jira/commit/85298e9)]
+31 -17
View File
@@ -157,7 +157,7 @@ func (c *Cli) CmdWorklog(action string, issue string) error {
if resp.StatusCode == 201 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
@@ -210,7 +210,7 @@ func (c *Cli) CmdEdit(issue string) error {
if resp.StatusCode == 204 {
c.Browse(issueData["key"].(string))
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issueData["key"], c.endpoint, issueData["key"])
}
return nil
@@ -416,7 +416,7 @@ func (c *Cli) CmdCreate() error {
"issue": key,
"link": link,
})
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s\n", key, link)
}
return nil
@@ -506,7 +506,7 @@ func (c *Cli) CmdSubtask(issue string) error {
"issue": key,
"link": link,
})
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s\n", key, link)
}
return nil
@@ -562,7 +562,7 @@ func (c *Cli) CmdIssueLink(inwardIssue string, issueLinkTypeName string, outward
}
if resp.StatusCode == 201 {
c.Browse(inwardIssue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", inwardIssue, c.endpoint, inwardIssue)
}
} else {
@@ -606,7 +606,7 @@ func (c *Cli) CmdBlocks(blocker string, issue string) error {
}
if resp.StatusCode == 201 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -651,7 +651,7 @@ func (c *Cli) CmdDups(duplicate string, issue string) error {
}
if resp.StatusCode == 201 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -699,7 +699,7 @@ func (c *Cli) CmdWatch(issue string, watcher string, remove bool) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -743,7 +743,7 @@ func (c *Cli) CmdVote(issue string, up bool) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -766,7 +766,7 @@ func (c *Cli) CmdRankAfter(issue, after string) error {
if err != nil {
return nil
}
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
@@ -778,7 +778,7 @@ func (c *Cli) CmdRankBefore(issue, before string) error {
if err != nil {
return nil
}
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
@@ -829,7 +829,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -899,7 +899,7 @@ func (c *Cli) CmdComment(issue string) error {
if resp.StatusCode == 201 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
@@ -959,7 +959,7 @@ func (c *Cli) CmdComponent(action string, project string, name string, desc stri
return err
}
if resp.StatusCode == 201 {
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s\n", project, name)
}
} else {
@@ -994,7 +994,7 @@ func (c *Cli) CmdLabels(action string, issue string, labels []string) error {
if resp.StatusCode == 204 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
@@ -1040,8 +1040,18 @@ func (c *Cli) CmdLabels(action string, issue string, labels []string) error {
func (c *Cli) CmdAssign(issue string, user string) error {
log.Debugf("assign called")
var userVal interface{} = user
// https://docs.atlassian.com/jira/REST/cloud/#api/2/issue-assign
// If the name is "-1" automatic assignee is used. A null name will remove the assignee.
if user == "" {
userVal = nil
}
if c.GetOptBool("default", false) {
userVal = "-1"
}
json, err := jsonEncode(map[string]interface{}{
"name": user,
"name": userVal,
})
if err != nil {
return err
@@ -1059,7 +1069,7 @@ func (c *Cli) CmdAssign(issue string, user string) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if !c.opts["quiet"].(bool) {
if !c.GetOptBool("quiet", false) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
@@ -1072,6 +1082,10 @@ func (c *Cli) CmdAssign(issue string, user string) error {
return nil
}
func (c *Cli) CmdUnassign(issue string) error {
return c.CmdAssign(issue, "")
}
// CmdExportTemplates will export the default templates to the template directory.
func (c *Cli) CmdExportTemplates() error {
dir := c.opts["directory"].(string)
+13 -3
View File
@@ -82,7 +82,8 @@ Usage:
jira comment ISSUE [--noedit] <Edit Options>
jira (set,add,remove) labels ISSUE [LABEL] ...
jira take ISSUE
jira (assign|give) ISSUE ASSIGNEE
jira (assign|give) ISSUE [ASSIGNEE|--default]
jira unassign ISSUE
jira fields
jira issuelinktypes
jira transmeta ISSUE
@@ -194,6 +195,7 @@ Command Options:
"rank": "rank",
"worklog": "worklog",
"addworklog": "addworklog",
"unassign": "unassign",
}
defaults := map[string]interface{}{
@@ -251,6 +253,7 @@ Command Options:
"Q|quiet": setopt,
"unixproxy": setopt,
"down": setopt,
"default": setopt,
})
if err := op.ProcessAll(os.Args[1:]); err != nil {
@@ -503,8 +506,15 @@ Command Options:
case "export-templates":
err = c.CmdExportTemplates()
case "assign":
requireArgs(2)
err = c.CmdAssign(args[0], args[1])
requireArgs(1)
assignee := ""
if len(args) > 1 {
assignee = args[1]
}
err = c.CmdAssign(args[0], assignee)
case "unassign":
requireArgs(1)
err = c.CmdUnassign(args[0])
case "view":
requireArgs(1)
err = c.CmdView(args[0])