aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-09 20:22:46 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-09 20:22:46 +0200
commitdd0823dd2ba68a9c778e81b26e53600b159b5a7d (patch)
tree7557afd91e6fcc12f7357be2616aaa28022f5d10 /commands/ls.go
parent09e097e1bf32ad153c139e3f6befad9fb059fd6e (diff)
downloadgit-bug-dd0823dd2ba68a9c778e81b26e53600b159b5a7d.tar.gz
ls: accept a query to sort and filter the list
Diffstat (limited to 'commands/ls.go')
-rw-r--r--commands/ls.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/commands/ls.go b/commands/ls.go
index 18496e06..339f1469 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -16,7 +16,17 @@ func runLsBug(cmd *cobra.Command, args []string) error {
}
defer backend.Close()
- allIds := backend.AllBugsId(cache.OrderByCreation, cache.OrderAscending)
+ var query *cache.Query
+ if len(args) >= 1 {
+ fmt.Println("Query", args[0])
+ query, err = cache.ParseQuery(args[0])
+
+ if err != nil {
+ return err
+ }
+ }
+
+ allIds := backend.QueryBugs(query)
for _, id := range allIds {
b, err := backend.ResolveBug(id)
@@ -50,7 +60,7 @@ func runLsBug(cmd *cobra.Command, args []string) error {
}
var lsCmd = &cobra.Command{
- Use: "ls",
+ Use: "ls <query>",
Short: "Display a summary of all bugs",
RunE: runLsBug,
}