From 26bd1dd11010b4d86cebe2510ad7085a6b316334 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 28 Jun 2020 18:26:29 +0200 Subject: commands: refactor to avoid globals --- commands/label_add.go | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'commands/label_add.go') diff --git a/commands/label_add.go b/commands/label_add.go index 39dfb085..83a9f064 100644 --- a/commands/label_add.go +++ b/commands/label_add.go @@ -1,16 +1,30 @@ package commands import ( - "fmt" + "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 runLabelAdd(cmd *cobra.Command, args []string) error { - backend, err := cache.NewRepoCache(repo) +func newLabelAddCommand() *cobra.Command { + env := newEnv() + + cmd := &cobra.Command{ + Use: "add []