pull.go

 1package commands
 2
 3import (
 4	"errors"
 5	"fmt"
 6	"github.com/MichaelMure/git-bug/bug"
 7	"github.com/MichaelMure/git-bug/repository"
 8)
 9
10func pull(repo repository.Repo, 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	if err := repo.PullRefs(remote, bug.BugsRefPattern+"*", bug.BugsRemoteRefPattern+"*"); err != nil {
21		return err
22	}
23	return nil
24}
25
26// showCmd defines the "push" subcommand.
27var pullCmd = &Command{
28	Usage: func(arg0 string) {
29		fmt.Printf("Usage: %s pull [<remote>]\n", arg0)
30	},
31	RunMethod: pull,
32}