aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-15 01:22:22 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-15 01:23:21 +0200
commitdfefba09ee706d2804969dc751c57a77f0d77bbf (patch)
tree53468a7de4dd91d6e85cd6e11be87d9e76e5778e /commands/ls.go
parentfcac83257a7d3a47cc78fad21fef57c35799ff63 (diff)
downloadgit-bug-dfefba09ee706d2804969dc751c57a77f0d77bbf.tar.gz
list --> ls, silly !
Diffstat (limited to 'commands/ls.go')
-rw-r--r--commands/ls.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/commands/ls.go b/commands/ls.go
new file mode 100644
index 00000000..2101dc84
--- /dev/null
+++ b/commands/ls.go
@@ -0,0 +1,36 @@
+package commands
+
+import (
+ "fmt"
+ b "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/repository"
+)
+
+func RunLsBug(repo repository.Repo, args []string) error {
+ 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()
+
+ fmt.Printf("%s %s\n", bug.HumanId(), snapshot.Title)
+ }
+
+ return nil
+}
+
+var lsCmd = &Command{
+ Usage: func(arg0 string) {
+ fmt.Printf("Usage: %s\n", arg0)
+ },
+ RunMethod: RunLsBug,
+}