mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-19 04:33:28 +02:00
gofmt
This commit is contained in:
+1
-1
@@ -244,7 +244,7 @@ func (c *Cli) editTemplate(template string, tmpFilePrefix string, templateData m
|
||||
if val, ok := c.opts["edit"]; ok && val == "false" {
|
||||
editing = false
|
||||
}
|
||||
|
||||
|
||||
for true {
|
||||
if editing {
|
||||
log.Debug("Running: %s %s", editor, tmpFileName)
|
||||
|
||||
@@ -101,9 +101,9 @@ func (c *Cli) CmdList() error {
|
||||
query = qbuff.String()
|
||||
}
|
||||
|
||||
fields := make([]string,0)
|
||||
fields := make([]string, 0)
|
||||
if qf, ok := c.opts["queryfields"]; ok {
|
||||
fields = strings.Split(qf,",")
|
||||
fields = strings.Split(qf, ",")
|
||||
} else {
|
||||
fields = append(fields, "summary")
|
||||
}
|
||||
@@ -112,7 +112,7 @@ func (c *Cli) CmdList() error {
|
||||
"jql": query,
|
||||
"startAt": "0",
|
||||
"maxResults": "500",
|
||||
"fields": fields,
|
||||
"fields": fields,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -297,7 +297,7 @@ func (c *Cli) CmdCreate(project string, issuetype string) error {
|
||||
key := json.(map[string]interface{})["key"]
|
||||
c.Browse(key.(string))
|
||||
fmt.Printf("OK %s %s/browse/%s\n", key, c.endpoint, key)
|
||||
|
||||
|
||||
}
|
||||
return nil
|
||||
} else {
|
||||
@@ -468,7 +468,7 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
uri = fmt.Sprintf("%s/rest/api/2/issue/%s", c.endpoint, issue)
|
||||
var issueData map[string]interface{}
|
||||
if data, err := responseToJson(c.get(uri)); err != nil {
|
||||
@@ -480,9 +480,9 @@ func (c *Cli) CmdTransition(issue string, trans string) error {
|
||||
issueData["overrides"] = c.opts
|
||||
issueData["transition"] = map[string]interface{}{
|
||||
"name": transName,
|
||||
"id": transId,
|
||||
};
|
||||
|
||||
"id": transId,
|
||||
}
|
||||
|
||||
return c.editTemplate(
|
||||
c.getTemplate("transition"),
|
||||
fmt.Sprintf("%s-trans-%s-", issue, trans),
|
||||
|
||||
@@ -22,7 +22,7 @@ const default_debug_template = "{{ . | toJson}}\n"
|
||||
|
||||
const default_list_template = "{{ range .issues }}{{ .key | append \":\" | printf \"%-12s\"}} {{ .fields.summary }}\n{{ end }}"
|
||||
|
||||
const default_table_template =`+{{ "-" | rep 16 }}+{{ "-" | rep 57 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
const default_table_template = `+{{ "-" | rep 16 }}+{{ "-" | rep 57 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
| {{ "Issue" | printf "%-14s" }} | {{ "Summary" | printf "%-55s" }} | {{ "Priority" | printf "%-12s" }} | {{ "Status" | printf "%-12s" }} | {{ "Age" | printf "%-10s" }} | {{ "Reporter" | printf "%-12s" }} | {{ "Assignee" | printf "%-12s" }} |
|
||||
+{{ "-" | rep 16 }}+{{ "-" | rep 57 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+{{ "-" | rep 12 }}+{{ "-" | rep 14 }}+{{ "-" | rep 14 }}+
|
||||
{{ range .issues }}| {{ .key | printf "%-14s"}} | {{ .fields.summary | abbrev 55 | printf "%-55s" }} | {{.fields.priority.name | printf "%-12s" }} | {{.fields.status.name | printf "%-12s" }} | {{.fields.created | age | printf "%-10s" }} | {{.fields.reporter.name | printf "%-12s"}} | {{if .fields.assignee }}{{.fields.assignee.name | printf "%-12s" }}{{else}}<unassigned>{{end}} |
|
||||
|
||||
+2
-3
@@ -79,7 +79,7 @@ func fuzzyAge(start string) (string, error) {
|
||||
} else if dh := delta.Hours(); dh < 48 {
|
||||
return "a day", nil
|
||||
} else {
|
||||
return fmt.Sprintf("%d days", int(delta.Hours() / 24)), nil
|
||||
return fmt.Sprintf("%d days", int(delta.Hours()/24)), nil
|
||||
}
|
||||
}
|
||||
return "unknown", nil
|
||||
@@ -163,13 +163,12 @@ func responseToJson(resp *http.Response, err error) (interface{}, error) {
|
||||
data := jsonDecode(resp.Body)
|
||||
if resp.StatusCode == 400 {
|
||||
if val, ok := data.(map[string]interface{})["errorMessages"]; ok {
|
||||
for _,errMsg := range val.([]interface{}) {
|
||||
for _, errMsg := range val.([]interface{}) {
|
||||
log.Error("%s", errMsg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return data, nil
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -147,7 +147,7 @@ Command Options:
|
||||
log.Error("endpoint option required. Either use --endpoint or set a enpoint option in your ~/.jira.d/config.yml file")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
||||
c := cli.New(opts)
|
||||
|
||||
log.Debug("opts: %s", opts)
|
||||
@@ -309,7 +309,7 @@ func populateEnv(args map[string]interface{}) {
|
||||
case string:
|
||||
os.Setenv(envName, v)
|
||||
case bool:
|
||||
if v {
|
||||
if v {
|
||||
os.Setenv(envName, "1")
|
||||
} else {
|
||||
os.Setenv(envName, "0")
|
||||
@@ -345,7 +345,7 @@ func loadConfigs(opts map[string]string) {
|
||||
for _, file := range paths {
|
||||
if stat, err := os.Stat(file); err == nil {
|
||||
// check to see if config file is exectuable
|
||||
if stat.Mode() & 0111 == 0 {
|
||||
if stat.Mode()&0111 == 0 {
|
||||
parseYaml(file, opts)
|
||||
} else {
|
||||
log.Debug("Found Executable Config file: %s", file)
|
||||
|
||||
Reference in New Issue
Block a user