2020-10-07 18:52:00 +01:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
"git.ctrlz.es/mgdelacroix/campaigner/app"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ListCmd() *cobra.Command {
|
2020-10-07 19:06:29 +01:00
|
|
|
cmd := &cobra.Command{
|
2020-10-07 18:52:00 +01: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),
|
|
|
|
}
|
2020-10-07 19:06:29 +01:00
|
|
|
|
|
|
|
cmd.Flags().BoolP("published-only", "p", false, "list only published tickets")
|
2020-10-15 15:42:22 +01:00
|
|
|
cmd.Flags().BoolP("links", "l", false, "print full links for jira and github ticket numbers")
|
2020-10-07 19:06:29 +01:00
|
|
|
|
|
|
|
return cmd
|
2020-10-07 18:52:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func listCmdF(a *app.App, cmd *cobra.Command, _ []string) {
|
2020-10-07 19:06:29 +01:00
|
|
|
publishedOnly, _ := cmd.Flags().GetBool("published-only")
|
2020-10-15 15:42:22 +01:00
|
|
|
printLinks, _ := cmd.Flags().GetBool("links")
|
2020-10-07 19:06:29 +01:00
|
|
|
|
2020-10-15 15:42:22 +01:00
|
|
|
a.Campaign.PrintList(publishedOnly, printLinks)
|
2020-10-07 18:52:00 +01:00
|
|
|
}
|