aboutsummaryrefslogtreecommitdiffstats
path: root/commands/push.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-19 12:30:25 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-19 12:36:01 +0200
commit7f5922f905831a85ffee4c9226b65715899ba758 (patch)
treed18a29a2ec13706efa7f5e9efc9515a92cf4513d /commands/push.go
parent459bb8747d9e84493b8d04a3172e6758452a75b9 (diff)
downloadgit-bug-7f5922f905831a85ffee4c9226b65715899ba758.tar.gz
rework all the commands to use cobra as a parser
Diffstat (limited to 'commands/push.go')
-rw-r--r--commands/push.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/commands/push.go b/commands/push.go
index 2f7d9b29..5965e898 100644
--- a/commands/push.go
+++ b/commands/push.go
@@ -3,10 +3,10 @@ package commands
import (
"errors"
"github.com/MichaelMure/git-bug/bug"
- "github.com/MichaelMure/git-bug/repository"
+ "github.com/spf13/cobra"
)
-func runPush(repo repository.Repo, args []string) error {
+func runPush(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return errors.New("Only pushing to one remote at a time is supported")
}
@@ -23,8 +23,12 @@ func runPush(repo repository.Repo, args []string) error {
}
// showCmd defines the "push" subcommand.
-var pushCmd = &Command{
- Description: "Push bugs update to a git remote",
- Usage: "[<remote>]",
- RunMethod: runPush,
+var pushCmd = &cobra.Command{
+ Use: "push [<remote>]",
+ Short: "Push bugs update to a git remote",
+ RunE: runPush,
+}
+
+func init() {
+ rootCmd.AddCommand(pushCmd)
}