diff options
Diffstat (limited to 'commands/comment_add.go')
-rw-r--r-- | commands/comment_add.go | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/commands/comment_add.go b/commands/comment_add.go index 46d0c8b8..c80e9ec5 100644 --- a/commands/comment_add.go +++ b/commands/comment_add.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/input" - "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -15,24 +15,12 @@ var ( ) func runCommentAdd(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] - if commentAddMessageFile != "" && commentAddMessage == "" { commentAddMessage, err = input.FromFile(commentAddMessageFile) if err != nil { @@ -51,7 +39,7 @@ func runCommentAdd(cmd *cobra.Command, args []string) error { } } - b, err := backend.ResolveBugPrefix(prefix) + b, args, err := _select.ResolveBug(backend, args) if err != nil { return err } @@ -65,7 +53,7 @@ func runCommentAdd(cmd *cobra.Command, args []string) error { } var commentAddCmd = &cobra.Command{ - Use: "add <id>", + Use: "add [<id>]", Short: "Add a new comment to a bug", RunE: runCommentAdd, } |