pull.go

 1package  commands
 2
 3import (
 4	"fmt"
 5	"github.com/MichaelMure/git-bug/repository"
 6	"errors"
 7)
 8
 9func pull(repo repository.Repo, args []string) error {
10	if len(args) > 1 {
11		return errors.New("only pulling from one remote at a time is supported")
12	}
13
14	remote := "origin"
15	if len(args) == 1 {
16		remote = args[0]
17	}
18
19	if err := repo.PullRefs(remote, bugsRefPattern); err != nil {
20		return err
21	}
22	return nil
23}
24
25// showCmd defines the "push" subcommand.
26var pullCmd = &Command{
27	Usage: func(arg0 string) {
28		fmt.Printf("Usage: %s pull [<remote>]\n", arg0)
29	},
30	RunMethod: func(repo repository.Repo, args []string) error {
31		return pull(repo, args)
32	},
33}