aboutsummaryrefslogtreecommitdiffstats
path: root/commands/status_open.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/status_open.go')
-rw-r--r--commands/status_open.go33
1 files changed, 19 insertions, 14 deletions
diff --git a/commands/status_open.go b/commands/status_open.go
index 1b1c426e..ff98fa33 100644
--- a/commands/status_open.go
+++ b/commands/status_open.go
@@ -1,14 +1,30 @@
package commands
import (
+ "github.com/spf13/cobra"
+
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/interrupt"
- "github.com/spf13/cobra"
)
-func runStatusOpen(cmd *cobra.Command, args []string) error {
- backend, err := cache.NewRepoCache(repo)
+func newStatusOpenCommand() *cobra.Command {
+ env := newEnv()
+
+ cmd := &cobra.Command{
+ Use: "open [<id>]",
+ Short: "Mark a bug as open.",
+ PreRunE: loadRepoEnsureUser(env),
+ RunE: func(cmd *cobra.Command, args []string) error {
+ return runStatusOpen(env, args)
+ },
+ }
+
+ return cmd
+}
+
+func runStatusOpen(env *Env, args []string) error {
+ backend, err := cache.NewRepoCache(env.repo)
if err != nil {
return err
}
@@ -27,14 +43,3 @@ func runStatusOpen(cmd *cobra.Command, args []string) error {
return b.Commit()
}
-
-var openCmd = &cobra.Command{
- Use: "open [<id>]",
- Short: "Mark a bug as open.",
- PreRunE: loadRepoEnsureUser,
- RunE: runStatusOpen,
-}
-
-func init() {
- statusCmd.AddCommand(openCmd)
-}