aboutsummaryrefslogtreecommitdiffstats
path: root/commands/comment.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/comment.go')
-rw-r--r--commands/comment.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/commands/comment.go b/commands/comment.go
index 46267979..9169d7d7 100644
--- a/commands/comment.go
+++ b/commands/comment.go
@@ -1,36 +1,24 @@
package commands
import (
- "errors"
"fmt"
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/MichaelMure/git-bug/util/text"
"github.com/spf13/cobra"
)
func runComment(cmd *cobra.Command, args []string) error {
- var err error
-
- if len(args) > 1 {
- return errors.New("Only one bug id is supported")
- }
-
- if len(args) == 0 {
- return errors.New("You must provide a bug id")
- }
-
backend, err := cache.NewRepoCache(repo)
if err != nil {
return err
}
defer backend.Close()
- prefix := args[0]
-
- b, err := backend.ResolveBugPrefix(prefix)
+ b, args, err := _select.ResolveBug(backend, args)
if err != nil {
return err
}
@@ -55,7 +43,7 @@ func commentsTextOutput(comments []bug.Comment) {
}
var commentCmd = &cobra.Command{
- Use: "comment <id>",
+ Use: "comment [<id>]",
Short: "Show a bug's comments",
RunE: runComment,
}