From 3534f552022cb6dd5a6a11b7d01772c21bbfecdf Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Sat, 29 Feb 2020 17:48:53 +0100 Subject: [PATCH] Add summary to the init command --- cmd/init.go | 5 ++++- model/campaign.go | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/init.go b/cmd/init.go index ef6776e..07d80a5 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -17,13 +17,16 @@ func InitCmd() *cobra.Command { cmd.Flags().StringP("epic", "e", "", "the epic id to associate this campaign with") _ = cmd.MarkFlagRequired("epic") + cmd.Flags().StringP("summary", "s", "", "the summary of the tickets. Can contain the variables {{.Filename}}, {{.LineNo}} and {{.Text}}") + _ = cmd.MarkFlagRequired("summary") return cmd } func initCmdF(cmd *cobra.Command, _ []string) { epic, _ := cmd.Flags().GetString("epic") - if err := campaign.Save(&model.Campaign{Epic: epic}); err != nil { + summary, _ := cmd.Flags().GetString("summary") + if err := campaign.Save(&model.Campaign{Epic: epic, Summary: summary}); err != nil { ErrorAndExit(cmd, err) } } diff --git a/model/campaign.go b/model/campaign.go index b0c2267..27534ab 100644 --- a/model/campaign.go +++ b/model/campaign.go @@ -2,5 +2,6 @@ package model type Campaign struct { Epic string `json:"epic"` + Summary string `json:"summary"` Tickets []*Ticket `json:"tickets,omitempty"` }