aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSladyn <gunnerforlife00@gmail.com>2019-02-14 00:38:55 +0530
committerSladyn <gunnerforlife00@gmail.com>2019-02-25 21:20:51 +0530
commit3c0c13bbbe934d0fa9476fa5c07bf04ea5a99b94 (patch)
tree1b3aea42623507dea0724299f1875d18641ff1a0
parentf70f38c8ee44338e803ba6bb306c13fe1c7f347a (diff)
downloadgit-bug-3c0c13bbbe934d0fa9476fa5c07bf04ea5a99b94.tar.gz
ls-id.go:Add ls-id [<prefix>] command
This file adds the ls-id command which returns the bug id matching the prefix the user enters. If no prefix entered it lists all the BugId's Closes #47
-rw-r--r--commands/ls-id.go59
-rw-r--r--doc/man/git-bug.14
-rw-r--r--misc/zsh_completion/git-bug2
3 files changed, 10 insertions, 55 deletions
diff --git a/commands/ls-id.go b/commands/ls-id.go
index 6e6da4c1..b9866828 100644
--- a/commands/ls-id.go
+++ b/commands/ls-id.go
@@ -4,68 +4,23 @@ import (
"fmt"
"strings"
- "github.com/MichaelMure/git-bug/bug"
+ "github.com/MichaelMure/git-bug/cache"
"github.com/spf13/cobra"
)
func runLsID(cmd *cobra.Command, args []string) error {
- if len(args) < 1 {
- _, err := ListAllID()
+ var backend *cache.RepoCache
- 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)
+ prefix := args[0]
- if err != nil {
- return "", err
- }
-
- for _, id := range IDlist {
- if strings.HasPrefix(id, prefix) {
- return id, nil
+ for _, id := range backend.AllBugsIds() {
+ if prefix == "" || strings.HasPrefix(id, prefix) {
+ fmt.Println(id)
}
}
- 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
+ return nil
}
var listBugIDCmd = &cobra.Command{
diff --git a/doc/man/git-bug.1 b/doc/man/git-bug.1
index 6a5e2901..183d60d8 100644
--- a/doc/man/git-bug.1
+++ b/doc/man/git-bug.1
@@ -1,4 +1,4 @@
-.TH "GIT-BUG" "1" "Feb 2019" "Generated from git-bug's source code" ""
+.TH "GIT-BUG" "1" "Dec 2018" "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\-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
+\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
diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug
index c8cc7c2c..2deae548 100644
--- a/misc/zsh_completion/git-bug
+++ b/misc/zsh_completion/git-bug
@@ -8,7 +8,7 @@ case $state in
level1)
case $words[1] in
git-bug)
- _arguments '1: :(add bridge commands comment deselect label ls ls-id ls-label pull push select show status termui title webui)'
+ _arguments '1: :(add bridge commands comment deselect label ls ls-label pull push select show status termui title webui)'
;;
*)
_arguments '*: :_files'