diff --git a/jira/cli/commands.go b/jira/cli/commands.go index 6aaa3c9..48440b9 100644 --- a/jira/cli/commands.go +++ b/jira/cli/commands.go @@ -496,7 +496,7 @@ func (c *Cli) CmdComment(issue string) error { } } - if comment, ok := c.opts["comment"]; ok { + if comment, ok := c.opts["comment"]; ok && comment != "" { json, err := jsonEncode(map[string]interface{}{ "body": comment, }) diff --git a/jira/cli/templates.go b/jira/cli/templates.go index 72f8203..22cbf5d 100644 --- a/jira/cli/templates.go +++ b/jira/cli/templates.go @@ -35,11 +35,11 @@ blockers: {{ range .fields.issuelinks }}{{if .outwardIssue}}{{ .outwardIssue.key depends: {{ range .fields.issuelinks }}{{if .inwardIssue}}{{ .inwardIssue.key }}[{{.inwardIssue.fields.status.name}}]{{end}}{{end}} priority: {{ .fields.priority.name }} description: | - {{ if .fields.description }}{{.fields.description | indent 2 }}{{end}} + {{ or .fields.description "" | indent 2 }} comments: {{ range .fields.comment.comments }} - | # {{.author.name}} at {{.created}} - {{ .body | indent 4}} + {{ or .body "" | indent 4}} {{end}} ` const default_edit_template = `update: @@ -93,7 +93,7 @@ const default_create_template = `fields: ` const default_comment_template = `body: | - {{ or .overrides.comment | indent 2 }} + {{ or .overrides.comment "" | indent 2 }} ` const default_transition_template = `update: diff --git a/jira/main.go b/jira/main.go index d8736c6..f0500ce 100644 --- a/jira/main.go +++ b/jira/main.go @@ -251,6 +251,7 @@ Command Options: setEditing(false) err = c.CmdTransition(args["ISSUE"].(string), "stop") } else if validCommand("comment") { + setEditing(true) err = c.CmdComment(args["ISSUE"].(string)) } else if validCommand("take") { err = c.CmdAssign(args["ISSUE"].(string), user)