Adds published-only flag to the list command

This commit is contained in:
Miguel de la Cruz 2020-10-07 20:06:29 +02:00
parent ce96e712e4
commit 8494b273dd
2 changed files with 10 additions and 4 deletions

View file

@ -7,15 +7,21 @@ import (
)
func ListCmd() *cobra.Command {
return &cobra.Command{
cmd := &cobra.Command{
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")
return cmd
}
func listCmdF(a *app.App, cmd *cobra.Command, _ []string) {
a.Campaign.PrintList()
publishedOnly, _ := cmd.Flags().GetBool("published-only")
a.Campaign.PrintList(publishedOnly)
}