aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls-id.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/ls-id.go')
-rw-r--r--commands/ls-id.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/commands/ls-id.go b/commands/ls-id.go
new file mode 100644
index 00000000..b9866828
--- /dev/null
+++ b/commands/ls-id.go
@@ -0,0 +1,35 @@
+package commands
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/MichaelMure/git-bug/cache"
+ "github.com/spf13/cobra"
+)
+
+func runLsID(cmd *cobra.Command, args []string) error {
+
+ var backend *cache.RepoCache
+
+ prefix := args[0]
+
+ for _, id := range backend.AllBugsIds() {
+ if prefix == "" || strings.HasPrefix(id, prefix) {
+ fmt.Println(id)
+ }
+ }
+
+ return nil
+}
+
+var listBugIDCmd = &cobra.Command{
+ Use: "ls-id [<prefix>]",
+ Short: "List Bug Id",
+ PreRunE: loadRepo,
+ RunE: runLsID,
+}
+
+func init() {
+ RootCmd.AddCommand(listBugIDCmd)
+}