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