campaigner/cmd/list.go

30 lines
773 B
Go
Raw Normal View History

2020-10-07 19:52:00 +02:00
package cmd
import (
"github.com/spf13/cobra"
"git.ctrlz.es/mgdelacroix/campaigner/app"
)
func ListCmd() *cobra.Command {
cmd := &cobra.Command{
2020-10-07 19:52:00 +02:00
Use: "list",
Short: "Prints a list of the campaign's tickets",
Long: "Prints a list of the campaign's tickets with their statuses and external ids",
Args: cobra.NoArgs,
Run: withApp(listCmdF),
}
cmd.Flags().BoolP("published-only", "p", false, "list only published tickets")
2020-10-15 16:42:22 +02:00
cmd.Flags().BoolP("links", "l", false, "print full links for jira and github ticket numbers")
return cmd
2020-10-07 19:52:00 +02:00
}
func listCmdF(a *app.App, cmd *cobra.Command, _ []string) {
publishedOnly, _ := cmd.Flags().GetBool("published-only")
2020-10-15 16:42:22 +02:00
printLinks, _ := cmd.Flags().GetBool("links")
2020-10-15 16:42:22 +02:00
a.Campaign.PrintList(publishedOnly, printLinks)
2020-10-07 19:52:00 +02:00
}