aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-19 12:30:25 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-19 12:36:01 +0200
commit7f5922f905831a85ffee4c9226b65715899ba758 (patch)
treed18a29a2ec13706efa7f5e9efc9515a92cf4513d /commands/ls.go
parent459bb8747d9e84493b8d04a3172e6758452a75b9 (diff)
downloadgit-bug-7f5922f905831a85ffee4c9226b65715899ba758.tar.gz
rework all the commands to use cobra as a parser
Diffstat (limited to 'commands/ls.go')
-rw-r--r--commands/ls.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/commands/ls.go b/commands/ls.go
index 0d188833..fe3f9288 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -3,11 +3,11 @@ package commands
import (
"fmt"
b "github.com/MichaelMure/git-bug/bug"
- "github.com/MichaelMure/git-bug/repository"
"github.com/MichaelMure/git-bug/util"
+ "github.com/spf13/cobra"
)
-func runLsBug(repo repository.Repo, args []string) error {
+func runLsBug(cmd *cobra.Command, args []string) error {
ids, err := repo.ListRefs(b.BugsRefPattern)
if err != nil {
@@ -46,8 +46,12 @@ func runLsBug(repo repository.Repo, args []string) error {
return nil
}
-var lsCmd = &Command{
- Description: "Display a summary of all bugs",
- Usage: "",
- RunMethod: runLsBug,
+var lsCmd = &cobra.Command{
+ Use: "ls",
+ Short: "Display a summary of all bugs",
+ RunE: runLsBug,
+}
+
+func init() {
+ rootCmd.AddCommand(lsCmd)
}