1package commands
2
3import (
4 "fmt"
5 b "github.com/MichaelMure/git-bug/bug"
6 "github.com/MichaelMure/git-bug/repository"
7)
8
9func runLsBug(repo repository.Repo, args []string) error {
10 ids, err := repo.ListRefs(b.BugsRefPattern)
11
12 if err != nil {
13 return err
14 }
15
16 for _, ref := range ids {
17 bug, err := b.ReadBug(repo, b.BugsRefPattern+ref)
18
19 if err != nil {
20 return err
21 }
22
23 snapshot := bug.Compile()
24
25 fmt.Printf("%s %s\t%s\t%s\n", bug.HumanId(), snapshot.Status, snapshot.Title, snapshot.Summary())
26 }
27
28 return nil
29}
30
31var lsCmd = &Command{
32 Description: "Display a summary of all bugs",
33 Usage: "",
34 RunMethod: runLsBug,
35}