aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/ls-id.go35
-rw-r--r--doc/md/git-bug.md1
-rw-r--r--misc/bash_completion/git-bug21
3 files changed, 57 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)
+}
diff --git a/doc/md/git-bug.md b/doc/md/git-bug.md
index e88cfd0c..a1c1c885 100644
--- a/doc/md/git-bug.md
+++ b/doc/md/git-bug.md
@@ -31,6 +31,7 @@ git-bug [flags]
* [git-bug deselect](git-bug_deselect.md) - Clear the implicitly selected bug
* [git-bug label](git-bug_label.md) - Display, add or remove labels
* [git-bug ls](git-bug_ls.md) - List bugs
+* [git-bug ls-id](git-bug_ls-id.md) - List Bug Id
* [git-bug ls-label](git-bug_ls-label.md) - List valid labels
* [git-bug pull](git-bug_pull.md) - Pull bugs update from a git remote
* [git-bug push](git-bug_push.md) - Push bugs update to a git remote
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug
index 4c22c1e0..8551223d 100644
--- a/misc/bash_completion/git-bug
+++ b/misc/bash_completion/git-bug
@@ -550,6 +550,26 @@ _git-bug_ls()
noun_aliases=()
}
+_git-bug_ls-id()
+{
+ last_command="git-bug_ls-id"
+
+ command_aliases=()
+
+ commands=()
+
+ flags=()
+ two_word_flags=()
+ local_nonpersistent_flags=()
+ flags_with_completion=()
+ flags_completion=()
+
+
+ must_have_one_flag=()
+ must_have_one_noun=()
+ noun_aliases=()
+}
+
_git-bug_ls-label()
{
last_command="git-bug_ls-label"
@@ -845,6 +865,7 @@ _git-bug_root_command()
commands+=("deselect")
commands+=("label")
commands+=("ls")
+ commands+=("ls-id")
commands+=("ls-label")
commands+=("pull")
commands+=("push")