Add pull command
This commit is contained in:
parent
7829bbca13
commit
2f6d27d831
5 changed files with 76 additions and 3 deletions
31
cmd/pull.go
Normal file
31
cmd/pull.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"git.ctrlz.es/mgdelacroix/campaigner/app"
|
||||
)
|
||||
|
||||
func PullCmd() *cobra.Command {
|
||||
return &cobra.Command{
|
||||
Use: "pull",
|
||||
Short: "Imports tickets from Jira",
|
||||
Long: "Imports all tickets from a Jira epic issue. This command is only intended to use when the Jira tickets are already created and we want to use campaigner to import and manage them",
|
||||
Args: cobra.NoArgs,
|
||||
Run: withApp(pullCmdF),
|
||||
}
|
||||
}
|
||||
|
||||
func pullCmdF(a *app.App, cmd *cobra.Command, _ []string) {
|
||||
tickets, err := a.GetTicketsFromJiraEpic()
|
||||
if err != nil {
|
||||
ErrorAndExit(cmd, err)
|
||||
}
|
||||
|
||||
a.Campaign.AddTickets(tickets, false)
|
||||
|
||||
if err := a.Save(); err != nil {
|
||||
ErrorAndExit(cmd, err)
|
||||
}
|
||||
cmd.Printf("%d tickets have been added\n", len(tickets))
|
||||
}
|
|
@ -45,6 +45,7 @@ func RootCmd() *cobra.Command {
|
|||
InitCmd(),
|
||||
StatusCmd(),
|
||||
PublishCmd(),
|
||||
PullCmd(),
|
||||
SyncCmd(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue