Add campaigner list command

This commit is contained in:
Miguel de la Cruz 2020-10-07 19:52:00 +02:00
parent 27965460d4
commit 0cff217a8b
4 changed files with 44 additions and 0 deletions

View file

@ -2,6 +2,7 @@ package model
import (
"bytes"
"encoding/json"
"fmt"
"os"
"strings"
@ -87,6 +88,26 @@ func (c *Campaign) PrintStatus() {
w.Flush()
}
func (c *Campaign) PrintList() {
for _, t := range c.Tickets {
if t.IsPublishedJira() {
var str string
if t.IsPublishedGithub() {
str = fmt.Sprintf("[%s / #%d] %s", t.JiraLink, t.GithubLink, t.Summary)
} else {
str = fmt.Sprintf("[%s] %s", t.JiraLink, t.Summary)
}
if t.GithubStatus != "" {
str += fmt.Sprintf(" (%s)", t.GithubStatus)
}
fmt.Println(str)
} else {
b, _ := json.Marshal(t)
fmt.Printf("unpublished: %s\n", string(b))
}
}
}
func (c *Campaign) AddTickets(tickets []*Ticket, fileOnly bool) {
c.Tickets = append(c.Tickets, tickets...)
c.RemoveDuplicateTickets(fileOnly)