1package commands
 2
 3import (
 4	"errors"
 5	"github.com/MichaelMure/git-bug/bug"
 6	"github.com/spf13/cobra"
 7)
 8
 9func runPush(cmd *cobra.Command, 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 := bug.Push(repo, remote); err != nil {
20		return err
21	}
22
23	return nil
24}
25
26// showCmd defines the "push" subcommand.
27var pushCmd = &cobra.Command{
28	Use:   "push [<remote>]",
29	Short: "Push bugs update to a git remote",
30	RunE:  runPush,
31}
32
33func init() {
34	RootCmd.AddCommand(pushCmd)
35}