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 runPull(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 Description: "Pull bugs update from a git remote",
29 Usage: "[<remote>]",
30 RunMethod: runPull,
31}