Add --links flag to the list command
This commit is contained in:
parent
5810cea342
commit
5d7e67a553
2 changed files with 16 additions and 4 deletions
|
@ -16,12 +16,14 @@ func ListCmd() *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flags().BoolP("published-only", "p", false, "list only published tickets")
|
cmd.Flags().BoolP("published-only", "p", false, "list only published tickets")
|
||||||
|
cmd.Flags().BoolP("links", "l", false, "print full links for jira and github ticket numbers")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func listCmdF(a *app.App, cmd *cobra.Command, _ []string) {
|
func listCmdF(a *app.App, cmd *cobra.Command, _ []string) {
|
||||||
publishedOnly, _ := cmd.Flags().GetBool("published-only")
|
publishedOnly, _ := cmd.Flags().GetBool("published-only")
|
||||||
|
printLinks, _ := cmd.Flags().GetBool("links")
|
||||||
|
|
||||||
a.Campaign.PrintList(publishedOnly)
|
a.Campaign.PrintList(publishedOnly, printLinks)
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,14 +88,24 @@ func (c *Campaign) PrintStatus() {
|
||||||
w.Flush()
|
w.Flush()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Campaign) PrintList(publishedOnly bool) {
|
func (c *Campaign) PrintList(publishedOnly, printLinks bool) {
|
||||||
for _, t := range c.Tickets {
|
for _, t := range c.Tickets {
|
||||||
if t.IsPublishedJira() {
|
if t.IsPublishedJira() {
|
||||||
|
jiraLink := t.JiraLink
|
||||||
|
if printLinks {
|
||||||
|
jiraLink = c.GetJiraUrl(t)
|
||||||
|
}
|
||||||
|
|
||||||
var str string
|
var str string
|
||||||
if t.IsPublishedGithub() {
|
if t.IsPublishedGithub() {
|
||||||
str = fmt.Sprintf("[%s / %s] %s", color.BlueString(t.JiraLink), color.CyanString(fmt.Sprintf("#%d", t.GithubLink)), t.Summary)
|
githubLink := fmt.Sprintf("#%d", t.GithubLink)
|
||||||
|
if printLinks {
|
||||||
|
githubLink = c.GetGithubUrl(t)
|
||||||
|
}
|
||||||
|
|
||||||
|
str = fmt.Sprintf("[%s / %s] %s", color.BlueString(jiraLink), color.CyanString(githubLink), t.Summary)
|
||||||
} else {
|
} else {
|
||||||
str = fmt.Sprintf("[%s] %s", color.BlueString(t.JiraLink), t.Summary)
|
str = fmt.Sprintf("[%s] %s", color.BlueString(jiraLink), t.Summary)
|
||||||
}
|
}
|
||||||
if t.GithubStatus != "" {
|
if t.GithubStatus != "" {
|
||||||
if t.IsClosed() {
|
if t.IsClosed() {
|
||||||
|
|
Loading…
Reference in a new issue