pull.go

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