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