fix(commands): create env.Env once for all Cobra commands

Steve Moyer created

Resolves #996

Change summary

commands/bridge/bridge.go               | 14 +++++-------
commands/bridge/bridge_auth.go          | 10 +++-----
commands/bridge/bridge_auth_addtoken.go |  3 -
commands/bridge/bridge_auth_rm.go       |  4 --
commands/bridge/bridge_auth_show.go     |  4 --
commands/bridge/bridge_new.go           |  3 -
commands/bridge/bridge_pull.go          |  3 -
commands/bridge/bridge_push.go          |  4 --
commands/bridge/bridge_rm.go            |  4 --
commands/bug/bug.go                     | 21 +++++++++---------
commands/bug/bug_comment.go             |  8 ++----
commands/bug/bug_comment_add.go         |  3 -
commands/bug/bug_comment_edit.go        |  3 -
commands/bug/bug_deselect.go            |  4 --
commands/bug/bug_label.go               |  8 ++----
commands/bug/bug_label_new.go           |  4 --
commands/bug/bug_label_rm.go            |  4 --
commands/bug/bug_new.go                 |  3 -
commands/bug/bug_rm.go                  |  4 --
commands/bug/bug_select.go              |  4 --
commands/bug/bug_show.go                |  3 -
commands/bug/bug_status.go              |  8 ++----
commands/bug/bug_status_close.go        |  4 --
commands/bug/bug_status_open.go         |  4 --
commands/bug/bug_title.go               |  6 +---
commands/bug/bug_title_edit.go          |  3 -
commands/commands.go                    |  3 -
commands/label.go                       |  4 --
commands/pull.go                        |  4 --
commands/push.go                        |  4 --
commands/root.go                        | 30 ++++++++++++++------------
commands/termui.go                      |  4 --
commands/user/user.go                   |  9 +++----
commands/user/user_adopt.go             |  4 --
commands/user/user_new.go               |  4 --
commands/user/user_show.go              |  3 -
commands/version.go                     |  3 -
commands/webui.go                       |  3 -
commands/wipe.go                        |  4 --
39 files changed, 81 insertions(+), 141 deletions(-)

Detailed changes

commands/bridge/bridge.go 🔗

@@ -7,9 +7,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func NewBridgeCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func NewBridgeCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "bridge",
 		Short:   "List bridges to other bug trackers",
@@ -20,11 +18,11 @@ func NewBridgeCommand() *cobra.Command {
 		Args: cobra.NoArgs,
 	}
 
-	cmd.AddCommand(newBridgeAuthCommand())
-	cmd.AddCommand(newBridgeNewCommand())
-	cmd.AddCommand(newBridgePullCommand())
-	cmd.AddCommand(newBridgePushCommand())
-	cmd.AddCommand(newBridgeRm())
+	cmd.AddCommand(newBridgeAuthCommand(env))
+	cmd.AddCommand(newBridgeNewCommand(env))
+	cmd.AddCommand(newBridgePullCommand(env))
+	cmd.AddCommand(newBridgePushCommand(env))
+	cmd.AddCommand(newBridgeRm(env))
 
 	return cmd
 }

commands/bridge/bridge_auth.go 🔗

@@ -12,9 +12,7 @@ import (
 	"github.com/MichaelMure/git-bug/util/colors"
 )
 
-func newBridgeAuthCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBridgeAuthCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "auth",
 		Short:   "List all known bridge authentication credentials",
@@ -25,9 +23,9 @@ func newBridgeAuthCommand() *cobra.Command {
 		Args: cobra.NoArgs,
 	}
 
-	cmd.AddCommand(newBridgeAuthAddTokenCommand())
-	cmd.AddCommand(newBridgeAuthRm())
-	cmd.AddCommand(newBridgeAuthShow())
+	cmd.AddCommand(newBridgeAuthAddTokenCommand(env))
+	cmd.AddCommand(newBridgeAuthRm(env))
+	cmd.AddCommand(newBridgeAuthShow(env))
 
 	return cmd
 }

commands/bridge/bridge_auth_addtoken.go 🔗

@@ -24,8 +24,7 @@ type bridgeAuthAddTokenOptions struct {
 	user   string
 }
 
-func newBridgeAuthAddTokenCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBridgeAuthAddTokenCommand(env *execenv.Env) *cobra.Command {
 	options := bridgeAuthAddTokenOptions{}
 
 	cmd := &cobra.Command{

commands/bridge/bridge_auth_rm.go 🔗

@@ -8,9 +8,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBridgeAuthRm() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBridgeAuthRm(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "rm BRIDGE_ID",
 		Short:   "Remove a credential",

commands/bridge/bridge_auth_show.go 🔗

@@ -13,9 +13,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBridgeAuthShow() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBridgeAuthShow(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "show",
 		Short:   "Display an authentication credential",

commands/bridge/bridge_new.go 🔗

@@ -26,8 +26,7 @@ type bridgeNewOptions struct {
 	nonInteractive bool
 }
 
-func newBridgeNewCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBridgeNewCommand(env *execenv.Env) *cobra.Command {
 	options := bridgeNewOptions{}
 
 	cmd := &cobra.Command{

commands/bridge/bridge_pull.go 🔗

@@ -23,8 +23,7 @@ type bridgePullOptions struct {
 	noResume    bool
 }
 
-func newBridgePullCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBridgePullCommand(env *execenv.Env) *cobra.Command {
 	options := bridgePullOptions{}
 
 	cmd := &cobra.Command{

commands/bridge/bridge_push.go 🔗

@@ -15,9 +15,7 @@ import (
 	"github.com/MichaelMure/git-bug/util/interrupt"
 )
 
-func newBridgePushCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBridgePushCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "push [NAME]",
 		Short:   "Push updates to remote bug tracker",

commands/bridge/bridge_rm.go 🔗

@@ -8,9 +8,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBridgeRm() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBridgeRm(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "rm NAME",
 		Short:   "Delete a configured bridge",

commands/bug/bug.go 🔗

@@ -33,8 +33,7 @@ type bugOptions struct {
 	outputFormat     string
 }
 
-func NewBugCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func NewBugCommand(env *execenv.Env) *cobra.Command {
 	options := bugOptions{}
 
 	cmd := &cobra.Command{
@@ -106,16 +105,16 @@ git bug status:open --by creation "foo bar" baz
 		child.GroupID = groupID
 	}
 
-	addCmdWithGroup(newBugDeselectCommand(), selectGroup)
-	addCmdWithGroup(newBugSelectCommand(), selectGroup)
+	addCmdWithGroup(newBugDeselectCommand(env), selectGroup)
+	addCmdWithGroup(newBugSelectCommand(env), selectGroup)
 
-	cmd.AddCommand(newBugCommentCommand())
-	cmd.AddCommand(newBugLabelCommand())
-	cmd.AddCommand(newBugNewCommand())
-	cmd.AddCommand(newBugRmCommand())
-	cmd.AddCommand(newBugShowCommand())
-	cmd.AddCommand(newBugStatusCommand())
-	cmd.AddCommand(newBugTitleCommand())
+	cmd.AddCommand(newBugCommentCommand(env))
+	cmd.AddCommand(newBugLabelCommand(env))
+	cmd.AddCommand(newBugNewCommand(env))
+	cmd.AddCommand(newBugRmCommand(env))
+	cmd.AddCommand(newBugShowCommand(env))
+	cmd.AddCommand(newBugStatusCommand(env))
+	cmd.AddCommand(newBugTitleCommand(env))
 
 	return cmd
 }

commands/bug/bug_comment.go 🔗

@@ -8,9 +8,7 @@ import (
 	"github.com/MichaelMure/git-bug/util/colors"
 )
 
-func newBugCommentCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugCommentCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "comment [BUG_ID]",
 		Short:   "List a bug's comments",
@@ -21,8 +19,8 @@ func newBugCommentCommand() *cobra.Command {
 		ValidArgsFunction: BugCompletion(env),
 	}
 
-	cmd.AddCommand(newBugCommentNewCommand())
-	cmd.AddCommand(newBugCommentEditCommand())
+	cmd.AddCommand(newBugCommentNewCommand(env))
+	cmd.AddCommand(newBugCommentEditCommand(env))
 
 	return cmd
 }

commands/bug/bug_comment_add.go 🔗

@@ -14,8 +14,7 @@ type bugCommentNewOptions struct {
 	nonInteractive bool
 }
 
-func newBugCommentNewCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBugCommentNewCommand(env *execenv.Env) *cobra.Command {
 	options := bugCommentNewOptions{}
 
 	cmd := &cobra.Command{

commands/bug/bug_comment_edit.go 🔗

@@ -13,8 +13,7 @@ type bugCommentEditOptions struct {
 	nonInteractive bool
 }
 
-func newBugCommentEditCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBugCommentEditCommand(env *execenv.Env) *cobra.Command {
 	options := bugCommentEditOptions{}
 
 	cmd := &cobra.Command{

commands/bug/bug_deselect.go 🔗

@@ -8,9 +8,7 @@ import (
 	"github.com/MichaelMure/git-bug/entities/bug"
 )
 
-func newBugDeselectCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugDeselectCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:   "deselect",
 		Short: "Clear the implicitly selected bug",

commands/bug/bug_label.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugLabelCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugLabelCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "label [BUG_ID]",
 		Short:   "Display labels of a bug",
@@ -19,8 +17,8 @@ func newBugLabelCommand() *cobra.Command {
 		ValidArgsFunction: BugCompletion(env),
 	}
 
-	cmd.AddCommand(newBugLabelNewCommand())
-	cmd.AddCommand(newBugLabelRmCommand())
+	cmd.AddCommand(newBugLabelNewCommand(env))
+	cmd.AddCommand(newBugLabelRmCommand(env))
 
 	return cmd
 }

commands/bug/bug_label_new.go 🔗

@@ -7,9 +7,7 @@ import (
 	"github.com/MichaelMure/git-bug/util/text"
 )
 
-func newBugLabelNewCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugLabelNewCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "new [BUG_ID] LABEL...",
 		Short:   "Add a label to a bug",

commands/bug/bug_label_rm.go 🔗

@@ -7,9 +7,7 @@ import (
 	"github.com/MichaelMure/git-bug/util/text"
 )
 
-func newBugLabelRmCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugLabelRmCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "rm [BUG_ID] LABEL...",
 		Short:   "Remove a label from a bug",

commands/bug/bug_new.go 🔗

@@ -15,8 +15,7 @@ type bugNewOptions struct {
 	nonInteractive bool
 }
 
-func newBugNewCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBugNewCommand(env *execenv.Env) *cobra.Command {
 	options := bugNewOptions{}
 
 	cmd := &cobra.Command{

commands/bug/bug_rm.go 🔗

@@ -8,9 +8,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugRmCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugRmCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "rm BUG_ID",
 		Short:   "Remove an existing bug",

commands/bug/bug_select.go 🔗

@@ -15,9 +15,7 @@ func ResolveSelected(repo *cache.RepoCache, args []string) (*cache.BugCache, []s
 	return _select.Resolve[*cache.BugCache](repo, bug.Typename, bug.Namespace, repo.Bugs(), args)
 }
 
-func newBugSelectCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugSelectCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:   "select BUG_ID",
 		Short: "Select a bug for implicit use in future commands",

commands/bug/bug_show.go 🔗

@@ -19,8 +19,7 @@ type bugShowOptions struct {
 	format string
 }
 
-func newBugShowCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBugShowCommand(env *execenv.Env) *cobra.Command {
 	options := bugShowOptions{}
 
 	cmd := &cobra.Command{

commands/bug/bug_status.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugStatusCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugStatusCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "status [BUG_ID]",
 		Short:   "Display the status of a bug",
@@ -19,8 +17,8 @@ func newBugStatusCommand() *cobra.Command {
 		ValidArgsFunction: BugCompletion(env),
 	}
 
-	cmd.AddCommand(newBugStatusCloseCommand())
-	cmd.AddCommand(newBugStatusOpenCommand())
+	cmd.AddCommand(newBugStatusCloseCommand(env))
+	cmd.AddCommand(newBugStatusOpenCommand(env))
 
 	return cmd
 }

commands/bug/bug_status_close.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugStatusCloseCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugStatusCloseCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "close [BUG_ID]",
 		Short:   "Mark a bug as closed",

commands/bug/bug_status_open.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugStatusOpenCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugStatusOpenCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "open [BUG_ID]",
 		Short:   "Mark a bug as open",

commands/bug/bug_title.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newBugTitleCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newBugTitleCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "title [BUG_ID]",
 		Short:   "Display the title of a bug",
@@ -19,7 +17,7 @@ func newBugTitleCommand() *cobra.Command {
 		ValidArgsFunction: BugCompletion(env),
 	}
 
-	cmd.AddCommand(newBugTitleEditCommand())
+	cmd.AddCommand(newBugTitleEditCommand(env))
 
 	return cmd
 }

commands/bug/bug_title_edit.go 🔗

@@ -13,8 +13,7 @@ type bugTitleEditOptions struct {
 	nonInteractive bool
 }
 
-func newBugTitleEditCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newBugTitleEditCommand(env *execenv.Env) *cobra.Command {
 	options := bugTitleEditOptions{}
 
 	cmd := &cobra.Command{

commands/commands.go 🔗

@@ -12,8 +12,7 @@ type commandOptions struct {
 	desc bool
 }
 
-func newCommandsCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newCommandsCommand(env *execenv.Env) *cobra.Command {
 	options := commandOptions{}
 
 	cmd := &cobra.Command{

commands/label.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newLabelCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newLabelCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:   "label",
 		Short: "List valid labels",

commands/pull.go 🔗

@@ -10,9 +10,7 @@ import (
 	"github.com/MichaelMure/git-bug/entity"
 )
 
-func newPullCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newPullCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "pull [REMOTE]",
 		Short:   "Pull updates from a git remote",

commands/push.go 🔗

@@ -9,9 +9,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newPushCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newPushCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "push [REMOTE]",
 		Short:   "Push updates to a git remote",

commands/root.go 🔗

@@ -7,10 +7,10 @@ import (
 
 	"github.com/spf13/cobra"
 
-	"github.com/MichaelMure/git-bug/commands/bridge"
-	"github.com/MichaelMure/git-bug/commands/bug"
+	bridgecmd "github.com/MichaelMure/git-bug/commands/bridge"
+	bugcmd "github.com/MichaelMure/git-bug/commands/bug"
 	"github.com/MichaelMure/git-bug/commands/execenv"
-	"github.com/MichaelMure/git-bug/commands/user"
+	usercmd "github.com/MichaelMure/git-bug/commands/user"
 )
 
 // These variables are initialized externally during the build. See the Makefile.
@@ -68,20 +68,22 @@ the same git remote you are already using to collaborate with other people.
 		child.GroupID = groupID
 	}
 
-	addCmdWithGroup(bugcmd.NewBugCommand(), entityGroup)
-	addCmdWithGroup(usercmd.NewUserCommand(), entityGroup)
-	addCmdWithGroup(newLabelCommand(), entityGroup)
+	env := execenv.NewEnv()
 
-	addCmdWithGroup(newTermUICommand(), uiGroup)
-	addCmdWithGroup(newWebUICommand(), uiGroup)
+	addCmdWithGroup(bugcmd.NewBugCommand(env), entityGroup)
+	addCmdWithGroup(usercmd.NewUserCommand(env), entityGroup)
+	addCmdWithGroup(newLabelCommand(env), entityGroup)
 
-	addCmdWithGroup(newPullCommand(), remoteGroup)
-	addCmdWithGroup(newPushCommand(), remoteGroup)
-	addCmdWithGroup(bridgecmd.NewBridgeCommand(), remoteGroup)
+	addCmdWithGroup(newTermUICommand(env), uiGroup)
+	addCmdWithGroup(newWebUICommand(env), uiGroup)
 
-	cmd.AddCommand(newCommandsCommand())
-	cmd.AddCommand(newVersionCommand())
-	cmd.AddCommand(newWipeCommand())
+	addCmdWithGroup(newPullCommand(env), remoteGroup)
+	addCmdWithGroup(newPushCommand(env), remoteGroup)
+	addCmdWithGroup(bridgecmd.NewBridgeCommand(env), remoteGroup)
+
+	cmd.AddCommand(newCommandsCommand(env))
+	cmd.AddCommand(newVersionCommand(env))
+	cmd.AddCommand(newWipeCommand(env))
 
 	return cmd
 }

commands/termui.go 🔗

@@ -7,9 +7,7 @@ import (
 	"github.com/MichaelMure/git-bug/termui"
 )
 
-func newTermUICommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newTermUICommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "termui",
 		Aliases: []string{"tui"},

commands/user/user.go 🔗

@@ -16,8 +16,7 @@ type userOptions struct {
 	format string
 }
 
-func NewUserCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func NewUserCommand(env *execenv.Env) *cobra.Command {
 	options := userOptions{}
 
 	cmd := &cobra.Command{
@@ -29,9 +28,9 @@ func NewUserCommand() *cobra.Command {
 		}),
 	}
 
-	cmd.AddCommand(newUserNewCommand())
-	cmd.AddCommand(newUserShowCommand())
-	cmd.AddCommand(newUserAdoptCommand())
+	cmd.AddCommand(newUserNewCommand(env))
+	cmd.AddCommand(newUserShowCommand(env))
+	cmd.AddCommand(newUserAdoptCommand(env))
 
 	flags := cmd.Flags()
 	flags.SortFlags = false

commands/user/user_adopt.go 🔗

@@ -7,9 +7,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newUserAdoptCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newUserAdoptCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "adopt USER_ID",
 		Short:   "Adopt an existing identity as your own",

commands/user/user_new.go 🔗

@@ -14,9 +14,7 @@ type userNewOptions struct {
 	nonInteractive bool
 }
 
-func newUserNewCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newUserNewCommand(env *execenv.Env) *cobra.Command {
 	options := userNewOptions{}
 	cmd := &cobra.Command{
 		Use:     "new",

commands/user/user_show.go 🔗

@@ -16,8 +16,7 @@ type userShowOptions struct {
 	fields string
 }
 
-func newUserShowCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newUserShowCommand(env *execenv.Env) *cobra.Command {
 	options := userShowOptions{}
 
 	cmd := &cobra.Command{

commands/version.go 🔗

@@ -14,8 +14,7 @@ type versionOptions struct {
 	all    bool
 }
 
-func newVersionCommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newVersionCommand(env *execenv.Env) *cobra.Command {
 	options := versionOptions{}
 
 	cmd := &cobra.Command{

commands/webui.go 🔗

@@ -42,8 +42,7 @@ type webUIOptions struct {
 	query     string
 }
 
-func newWebUICommand() *cobra.Command {
-	env := execenv.NewEnv()
+func newWebUICommand(env *execenv.Env) *cobra.Command {
 	options := webUIOptions{}
 
 	cmd := &cobra.Command{

commands/wipe.go 🔗

@@ -6,9 +6,7 @@ import (
 	"github.com/MichaelMure/git-bug/commands/execenv"
 )
 
-func newWipeCommand() *cobra.Command {
-	env := execenv.NewEnv()
-
+func newWipeCommand(env *execenv.Env) *cobra.Command {
 	cmd := &cobra.Command{
 		Use:     "wipe",
 		Short:   "Wipe git-bug from the git repository",