From a45ece05e6cc02f8f9d8e669cc5ea942b0728eaa Mon Sep 17 00:00:00 2001 From: Sladyn Date: Tue, 5 Mar 2019 00:03:38 +0530 Subject: ls-id.go: Fixing ls-id Adding check for length of args Pulling bugIds from correct backend. --- commands/ls-id.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'commands') diff --git a/commands/ls-id.go b/commands/ls-id.go index b9866828..55548556 100644 --- a/commands/ls-id.go +++ b/commands/ls-id.go @@ -10,9 +10,17 @@ import ( func runLsID(cmd *cobra.Command, args []string) error { - var backend *cache.RepoCache + backend, err := cache.NewRepoCache(repo) + if err != nil { + return err + } + defer backend.Close() - prefix := args[0] + var prefix string + prefix = "" + if len(args) != 0 { + prefix = args[0] + } for _, id := range backend.AllBugsIds() { if prefix == "" || strings.HasPrefix(id, prefix) { -- cgit