aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls-labels.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ls-labels.go')
-rw-r--r--commands/ls-labels.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/commands/ls-labels.go b/commands/ls-labels.go
index 3473aadd..a7c2fb6f 100644
--- a/commands/ls-labels.go
+++ b/commands/ls-labels.go
@@ -2,9 +2,6 @@ package commands
import (
"github.com/spf13/cobra"
-
- "github.com/MichaelMure/git-bug/cache"
- "github.com/MichaelMure/git-bug/util/interrupt"
)
func newLsLabelCommand() *cobra.Command {
@@ -16,7 +13,8 @@ func newLsLabelCommand() *cobra.Command {
Long: `List valid labels.
Note: in the future, a proper label policy could be implemented where valid labels are defined in a configuration file. Until that, the default behavior is to return the list of labels already used.`,
- PreRunE: loadRepo(env),
+ PreRunE: loadBackend(env),
+ PostRunE: closeBackend(env),
RunE: func(cmd *cobra.Command, args []string) error {
return runLsLabel(env)
},
@@ -26,14 +24,7 @@ Note: in the future, a proper label policy could be implemented where valid labe
}
func runLsLabel(env *Env) error {
- backend, err := cache.NewRepoCache(env.repo)
- if err != nil {
- return err
- }
- defer backend.Close()
- interrupt.RegisterCleaner(backend.Close)
-
- labels := backend.ValidLabels()
+ labels := env.backend.ValidLabels()
for _, l := range labels {
env.out.Println(l)