Add view comments command
This commit is contained in:
parent
d31ad3c65a
commit
b12a5c5163
20
actions.go
20
actions.go
@ -294,6 +294,7 @@ func ActionViewCard(_ []string) {
|
|||||||
} else {
|
} else {
|
||||||
fmt.Printf("Assignee: Unassigned\n")
|
fmt.Printf("Assignee: Unassigned\n")
|
||||||
}
|
}
|
||||||
|
fmt.Printf("Number of comments: %d\n", len(issue.Fields.Comments.Comments))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ActionViewDescription(_ []string) {
|
func ActionViewDescription(_ []string) {
|
||||||
@ -309,6 +310,25 @@ func ActionViewDescription(_ []string) {
|
|||||||
println(issue.Fields.Description)
|
println(issue.Fields.Description)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ActionViewComments(_ []string) {
|
||||||
|
if !HasIssue() {
|
||||||
|
printError("No issue selected", nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
issue, err := GetIssue(GetIssueKey())
|
||||||
|
if err != nil {
|
||||||
|
printError("Failed to get issue", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i, comment := range issue.Fields.Comments.Comments {
|
||||||
|
if i != 0 {
|
||||||
|
println()
|
||||||
|
}
|
||||||
|
fmt.Printf("%s at %s:\n", red(comment.Author.DisplayName), blue(comment.Created))
|
||||||
|
fmt.Printf(" %s\n", comment.Body)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func ActionSetStatus(_ []string) {
|
func ActionSetStatus(_ []string) {
|
||||||
if !HasIssue() {
|
if !HasIssue() {
|
||||||
printError("No issue selected", nil)
|
printError("No issue selected", nil)
|
||||||
|
@ -51,8 +51,9 @@ var CommandTree = []CommandArg{
|
|||||||
option("my", command("issue", ActionUseMyIssue).WithHelp("Use an issue assigned to me")),
|
option("my", command("issue", ActionUseMyIssue).WithHelp("Use an issue assigned to me")),
|
||||||
).WithHelp("Select something for further commands"),
|
).WithHelp("Select something for further commands"),
|
||||||
option("view",
|
option("view",
|
||||||
command("card", ActionViewCard).WithHelp("View general information about the ticket"),
|
command("card", ActionViewCard).WithHelp("View general information about the issue"),
|
||||||
command("description", ActionViewDescription).WithHelp("View description of a ticket"),
|
command("description", ActionViewDescription).WithHelp("View description of a issue"),
|
||||||
|
command("comments", ActionViewComments).WithHelp("View comments of an issue"),
|
||||||
).WithHelp("View data about something"),
|
).WithHelp("View data about something"),
|
||||||
option("set",
|
option("set",
|
||||||
command("status", ActionSetStatus).WithHelp("Set status of a ticket"),
|
command("status", ActionSetStatus).WithHelp("Set status of a ticket"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user