aboutsummaryrefslogtreecommitdiffstats
path: root/commands/open.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/open.go
parent459bb8747d9e84493b8d04a3172e6758452a75b9 (diff)
downloadgit-bug-7f5922f905831a85ffee4c9226b65715899ba758.tar.gz
rework all the commands to use cobra as a parser
Diffstat (limited to 'commands/open.go')
-rw-r--r--commands/open.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/commands/open.go b/commands/open.go
index 56416931..83e20a4a 100644
--- a/commands/open.go
+++ b/commands/open.go
@@ -4,10 +4,10 @@ import (
"errors"
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/bug/operations"
- "github.com/MichaelMure/git-bug/repository"
+ "github.com/spf13/cobra"
)
-func runOpenBug(repo repository.Repo, args []string) error {
+func runOpenBug(cmd *cobra.Command, args []string) error {
if len(args) > 1 {
return errors.New("Only opening one bug at a time is supported")
}
@@ -37,8 +37,12 @@ func runOpenBug(repo repository.Repo, args []string) error {
return err
}
-var openCmd = &Command{
- Description: "Mark the bug as open",
- Usage: "<id>",
- RunMethod: runOpenBug,
+var openCmd = &cobra.Command{
+ Use: "open <id>",
+ Short: "Mark the bug as open",
+ RunE: runOpenBug,
+}
+
+func init() {
+ rootCmd.AddCommand(openCmd)
}