Detailed changes
@@ -0,0 +1,80 @@
+package commands
+
+import (
+ "fmt"
+ "strings"
+
+ "github.com/MichaelMure/git-bug/bug"
+ "github.com/spf13/cobra"
+)
+
+func runLsID(cmd *cobra.Command, args []string) error {
+
+ if len(args) < 1 {
+ _, err := ListAllID()
+
+ if err != nil {
+ return err
+ }
+
+ return nil
+ }
+ answer, err := ListID(args[0])
+
+ if err != nil {
+ return err
+ }
+
+ if answer == "" {
+ fmt.Printf("No matching bug Id with prefix %s\n", args[0])
+ } else {
+ fmt.Println(answer)
+ }
+
+ return nil
+}
+
+//ListID lists the local bug id after taking the prefix as input
+func ListID(prefix string) (string, error) {
+
+ IDlist, err := bug.ListLocalIds(repo)
+
+ if err != nil {
+ return "", err
+ }
+
+ for _, id := range IDlist {
+ if strings.HasPrefix(id, prefix) {
+ return id, nil
+ }
+ }
+
+ return "", nil
+
+}
+
+//ListAllID lists all the local bug id
+func ListAllID() (string, error) {
+
+ IDlist, err := bug.ListLocalIds(repo)
+ if err != nil {
+ return "", err
+ }
+
+ for _, id := range IDlist {
+ 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)
+}
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Dec 2018" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
.nh
.ad l
@@ -31,4 +31,4 @@ the same git remote your are already using to collaborate with other peoples.
.SH SEE ALSO
.PP
-\fBgit\-bug\-add(1)\fP, \fBgit\-bug\-bridge(1)\fP, \fBgit\-bug\-commands(1)\fP, \fBgit\-bug\-comment(1)\fP, \fBgit\-bug\-deselect(1)\fP, \fBgit\-bug\-label(1)\fP, \fBgit\-bug\-ls(1)\fP, \fBgit\-bug\-ls\-label(1)\fP, \fBgit\-bug\-pull(1)\fP, \fBgit\-bug\-push(1)\fP, \fBgit\-bug\-select(1)\fP, \fBgit\-bug\-show(1)\fP, \fBgit\-bug\-status(1)\fP, \fBgit\-bug\-termui(1)\fP, \fBgit\-bug\-title(1)\fP, \fBgit\-bug\-webui(1)\fP
+\fBgit\-bug\-add(1)\fP, \fBgit\-bug\-bridge(1)\fP, \fBgit\-bug\-commands(1)\fP, \fBgit\-bug\-comment(1)\fP, \fBgit\-bug\-deselect(1)\fP, \fBgit\-bug\-label(1)\fP, \fBgit\-bug\-ls(1)\fP, \fBgit\-bug\-ls\-id(1)\fP, \fBgit\-bug\-ls\-label(1)\fP, \fBgit\-bug\-pull(1)\fP, \fBgit\-bug\-push(1)\fP, \fBgit\-bug\-select(1)\fP, \fBgit\-bug\-show(1)\fP, \fBgit\-bug\-status(1)\fP, \fBgit\-bug\-termui(1)\fP, \fBgit\-bug\-title(1)\fP, \fBgit\-bug\-webui(1)\fP
@@ -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
@@ -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"
@@ -816,6 +836,7 @@ _git-bug_root_command()
commands+=("deselect")
commands+=("label")
commands+=("ls")
+ commands+=("ls-id")
commands+=("ls-label")
commands+=("pull")
commands+=("push")
@@ -8,7 +8,7 @@ case $state in
level1)
case $words[1] in
git-bug)
- _arguments '1: :(add bridge commands comment deselect label ls ls-label pull push select show status termui title webui)'
+ _arguments '1: :(add bridge commands comment deselect label ls ls-id ls-label pull push select show status termui title webui)'
;;
*)
_arguments '*: :_files'