diff --git a/cmd/init.go b/cmd/init.go index 07d80a5..9270d2d 100644 --- a/cmd/init.go +++ b/cmd/init.go @@ -15,6 +15,8 @@ func InitCmd() *cobra.Command { Run: initCmdF, } + cmd.Flags().StringP("project", "p", "", "the jira project key to associate the tickets with") + _ = cmd.MarkFlagRequired("project") 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}}") @@ -24,9 +26,10 @@ func InitCmd() *cobra.Command { } func initCmdF(cmd *cobra.Command, _ []string) { + project, _ := cmd.Flags().GetString("project") epic, _ := cmd.Flags().GetString("epic") summary, _ := cmd.Flags().GetString("summary") - if err := campaign.Save(&model.Campaign{Epic: epic, Summary: summary}); err != nil { + if err := campaign.Save(&model.Campaign{Project: project, Epic: epic, Summary: summary}); err != nil { ErrorAndExit(cmd, err) } } diff --git a/model/campaign.go b/model/campaign.go index 27534ab..39ed165 100644 --- a/model/campaign.go +++ b/model/campaign.go @@ -1,6 +1,7 @@ package model type Campaign struct { + Project string `json:"project"` Epic string `json:"epic"` Summary string `json:"summary"` Tickets []*Ticket `json:"tickets,omitempty"`