From dfefba09ee706d2804969dc751c57a77f0d77bbf Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 15 Jul 2018 01:22:22 +0200 Subject: list --> ls, silly ! --- commands/commands.go | 2 +- commands/list.go | 36 ------------------------------------ commands/ls.go | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 37 deletions(-) delete mode 100644 commands/list.go create mode 100644 commands/ls.go (limited to 'commands') diff --git a/commands/commands.go b/commands/commands.go index f4e9aef9..7c4e3ab9 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -23,7 +23,7 @@ func (cmd *Command) Run(repo repository.Repo, args []string) error { // CommandMap defines all of the available (sub)commands. var CommandMap = map[string]*Command{ - "list": listCmd, + "ls": lsCmd, "new": newCmd, "pull": pullCmd, "push": pushCmd, diff --git a/commands/list.go b/commands/list.go deleted file mode 100644 index 87c417cf..00000000 --- a/commands/list.go +++ /dev/null @@ -1,36 +0,0 @@ -package commands - -import ( - "fmt" - b "github.com/MichaelMure/git-bug/bug" - "github.com/MichaelMure/git-bug/repository" -) - -func RunListBug(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 listCmd = &Command{ - Usage: func(arg0 string) { - fmt.Printf("Usage: %s\n", arg0) - }, - RunMethod: RunListBug, -} 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, +} -- cgit