Skip to content

Commit

Permalink
fix jira trans TRANS ISSUE (case sensitivity issue), also go fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
coryb committed Dec 10, 2015
1 parent dd419b1 commit 3c30f3b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions jira/cli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func (c *Cli) CmdEdit(issue string) error {

if resp.StatusCode == 204 {
c.Browse(issueData["key"].(string))
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issueData["key"], c.endpoint, issueData["key"])
}
return nil
Expand Down Expand Up @@ -267,9 +267,9 @@ func (c *Cli) CmdCreate() error {
c.Browse(key)
c.SaveData(map[string]string{
"issue": key,
"link": link,
"link": link,
})
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s\n", key, link)
}
}
Expand Down Expand Up @@ -326,7 +326,7 @@ func (c *Cli) CmdBlocks(blocker string, issue string) error {
}
if resp.StatusCode == 201 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
Expand Down Expand Up @@ -369,7 +369,7 @@ func (c *Cli) CmdDups(duplicate string, issue string) error {
}
if resp.StatusCode == 201 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
Expand Down Expand Up @@ -403,7 +403,7 @@ func (c *Cli) CmdWatch(issue string) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
Expand Down Expand Up @@ -432,7 +432,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
name := transition.(map[string]interface{})["name"].(string)
id := transition.(map[string]interface{})["id"].(string)
found = append(found, name)
if strings.Contains(strings.ToLower(name), trans) {
if strings.Contains(strings.ToLower(name), strings.ToLower(trans)) {
transName = name
transId = id
transMeta = transition.(map[string]interface{})
Expand All @@ -459,7 +459,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
Expand Down Expand Up @@ -512,7 +512,7 @@ func (c *Cli) CmdComment(issue string) error {

if resp.StatusCode == 201 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
return nil
Expand Down Expand Up @@ -566,7 +566,7 @@ func (c *Cli) CmdAssign(issue string, user string) error {
}
if resp.StatusCode == 204 {
c.Browse(issue)
if ! c.opts["quiet"].(bool) {
if !c.opts["quiet"].(bool) {
fmt.Printf("OK %s %s/browse/%s\n", issue, c.endpoint, issue)
}
} else {
Expand Down Expand Up @@ -609,13 +609,13 @@ func (c *Cli) CmdExportTemplates() error {
func (c *Cli) CmdRequest(uri, content string) (err error) {
log.Debug("request called")

if ! strings.HasPrefix(uri, "http") {
if !strings.HasPrefix(uri, "http") {
uri = fmt.Sprintf("%s%s", c.endpoint, uri)
}

method := strings.ToUpper(c.opts["method"].(string))
var data interface{}
if method == "GET" {
if method == "GET" {
data, err = responseToJson(c.get(uri))
} else if method == "POST" {
data, err = responseToJson(c.post(uri, content))
Expand Down
2 changes: 1 addition & 1 deletion jira/cli/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"encoding/json"
"errors"
"fmt"
"gopkg.in/coryb/yaml.v2"
"github.com/mgutz/ansi"
"gopkg.in/coryb/yaml.v2"
"io"
"io/ioutil"
"net/http"
Expand Down
8 changes: 4 additions & 4 deletions jira/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
)

var (
log = logging.MustGetLogger("jira")
format = "%{color}%{time:2006-01-02T15:04:05.000Z07:00} %{level:-5s} [%{shortfile}]%{color:reset} %{message}"
log = logging.MustGetLogger("jira")
format = "%{color}%{time:2006-01-02T15:04:05.000Z07:00} %{level:-5s} [%{shortfile}]%{color:reset} %{message}"
buildVersion string
)
)

func main() {
logBackend := logging.NewLogBackend(os.Stderr, "", 0)
Expand Down Expand Up @@ -349,7 +349,7 @@ Command Options:
case "transition":
requireArgs(2)
setEditing(true)
err = c.CmdTransition(args[0], args[1])
err = c.CmdTransition(args[1], args[0])
case "close":
requireArgs(1)
setEditing(false)
Expand Down

0 comments on commit 3c30f3b

Please sign in to comment.