git-bug/commands/ls.go

37 lines
602 B
Go
Raw Normal View History

2018-07-14 23:19:05 +03:00
package commands
import (
"fmt"
b "github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/repository"
)
2018-07-15 02:22:22 +03:00
func RunLsBug(repo repository.Repo, args []string) error {
2018-07-14 23:19:05 +03:00
refs, err := repo.ListRefs(b.BugsRefPattern)
if err != nil {
return err
}
for _, ref := range refs {
bug, err := b.ReadBug(repo, ref)
if err != nil {
return err
}
snapshot := bug.Compile()
2018-07-15 02:43:20 +03:00
fmt.Printf("%s %s\t%s\n", bug.HumanId(), snapshot.Title, snapshot.Summary())
2018-07-14 23:19:05 +03:00
}
return nil
}
2018-07-15 02:22:22 +03:00
var lsCmd = &Command{
2018-07-14 23:19:05 +03:00
Usage: func(arg0 string) {
fmt.Printf("Usage: %s\n", arg0)
},
2018-07-15 02:22:22 +03:00
RunMethod: RunLsBug,
2018-07-14 23:19:05 +03:00
}