Add summary to the init command

This commit is contained in:
Miguel de la Cruz 2020-02-29 17:48:53 +01:00
parent b38a0ff437
commit 3534f55202
2 changed files with 5 additions and 1 deletions

View file

@ -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)
}
}

View file

@ -2,5 +2,6 @@ package model
type Campaign struct {
Epic string `json:"epic"`
Summary string `json:"summary"`
Tickets []*Ticket `json:"tickets,omitempty"`
}