aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls-id.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ls-id.go')
-rw-r--r--commands/ls-id.go19
1 files changed, 5 insertions, 14 deletions
diff --git a/commands/ls-id.go b/commands/ls-id.go
index 6624793d..bed6c057 100644
--- a/commands/ls-id.go
+++ b/commands/ls-id.go
@@ -2,18 +2,16 @@ package commands
import (
"github.com/spf13/cobra"
-
- "github.com/MichaelMure/git-bug/cache"
- "github.com/MichaelMure/git-bug/util/interrupt"
)
func newLsIdCommand() *cobra.Command {
env := newEnv()
cmd := &cobra.Command{
- Use: "ls-id [<prefix>]",
- Short: "List bug identifiers.",
- PreRunE: loadRepo(env),
+ Use: "ls-id [<prefix>]",
+ Short: "List bug identifiers.",
+ PreRunE: loadBackend(env),
+ PostRunE: closeBackend(env),
RunE: func(cmd *cobra.Command, args []string) error {
return runLsId(env, args)
},
@@ -23,19 +21,12 @@ func newLsIdCommand() *cobra.Command {
}
func runLsId(env *Env, args []string) error {
- backend, err := cache.NewRepoCache(env.repo)
- if err != nil {
- return err
- }
- defer backend.Close()
- interrupt.RegisterCleaner(backend.Close)
-
var prefix = ""
if len(args) != 0 {
prefix = args[0]
}
- for _, id := range backend.AllBugsIds() {
+ for _, id := range env.backend.AllBugsIds() {
if prefix == "" || id.HasPrefix(prefix) {
env.out.Println(id)
}