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 runPush(repo repository.Repo, args []string) error {
11 if len(args) > 1 {
12 return errors.New("Only pushing to 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.PushRefs(remote, bug.BugsRefPattern+"*"); err != nil {
21 return err
22 }
23 return nil
24}
25
26// showCmd defines the "push" subcommand.
27var pushCmd = &Command{
28 Description: "Push bugs update to a git remote",
29 Usage: "[<remote>]",
30 RunMethod: runPush,
31}