pull.go

 1package commands
 2
 3import (
 4	"errors"
 5	"os"
 6
 7	"github.com/MichaelMure/git-bug/bug"
 8	"github.com/spf13/cobra"
 9)
10
11func runPull(cmd *cobra.Command, args []string) error {
12	if len(args) > 1 {
13		return errors.New("Only pulling from one remote at a time is supported")
14	}
15
16	remote := "origin"
17	if len(args) == 1 {
18		remote = args[0]
19	}
20
21	return bug.Pull(repo, os.Stdout, remote)
22}
23
24// showCmd defines the "push" subcommand.
25var pullCmd = &cobra.Command{
26	Use:   "pull [<remote>]",
27	Short: "Pull bugs update from a git remote",
28	RunE:  runPull,
29}
30
31func init() {
32	RootCmd.AddCommand(pullCmd)
33}