diff --git a/common/githubcommands.go b/common/githubcommands.go index 028dc09..09a0324 100644 --- a/common/githubcommands.go +++ b/common/githubcommands.go @@ -3,6 +3,7 @@ package common import ( "context" "fmt" + "regexp" "strconv" "strings" @@ -160,9 +161,17 @@ func GetStatus(c *clif.Command, out clif.Output) []CardslistItem { var cardslist []CardslistItem for _, project := range projectslist { cards := getCards(client, project) - out.Printf("\nList: " + project.GetName() + "\n") + out.Printf("\nProject: " + project.GetName() + "\n") for _, card := range cards { - out.Printf(strconv.Itoa(item) + "| <" + card.GetColumnName() + "> " + card.GetNote() + "\n") + title := "" + if card.GetContentURL() != "" { + issue := getIssueDetails(c, card.GetContentURL()) + title = "Issue #" + strconv.Itoa(issue.GetNumber()) + " : " + issue.GetTitle() + } else { + title = card.GetNote() + } + + out.Printf("%3s| <%s> %s\n", strconv.Itoa(item), card.GetColumnName(), title) cardslist = append(cardslist, CardslistItem{ id: item, carddetails: card, @@ -175,6 +184,18 @@ func GetStatus(c *clif.Command, out clif.Output) []CardslistItem { return cardslist } +func getIssueDetails(c *clif.Command, issueURL string) *github.Issue { + client := login(c) + + re := regexp.MustCompile(`https://api.github.com/repos/(.*)/(.*)/issues/(.*)`) + findings := re.FindAllStringSubmatch(issueURL, -1) + + issueNR, _ := strconv.Atoi(findings[0][3]) + issue, _, _ := client.Issues.Get(ctx, findings[0][1], findings[0][2], issueNR) + + return issue +} + func MoveCard(c *clif.Command, out clif.Output, in clif.Input) { client := login(c) diff --git a/main/main.go b/main/main.go index 51dfdd5..914da93 100644 --- a/main/main.go +++ b/main/main.go @@ -37,7 +37,7 @@ func main() { "open": "\U00002B50", "done": "\U00002705", "closed": "\U0001F512", - "in progress": "\U0001F528", + "in progress": "\U0001F525", "waiting": "\U0001F551", "critical": "\U000026A0", "idea": "\U0001F4A1",