aboutsummaryrefslogtreecommitdiffstats
path: root/commands/title.go
diff options
context:
space:
mode:
Diffstat (limited to 'commands/title.go')
-rw-r--r--commands/title.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/commands/title.go b/commands/title.go
index 16cfc342..dd5fbfb1 100644
--- a/commands/title.go
+++ b/commands/title.go
@@ -4,30 +4,18 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
- "github.com/pkg/errors"
+ "github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
func runTitle(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
}
@@ -40,7 +28,7 @@ func runTitle(cmd *cobra.Command, args []string) error {
}
var titleCmd = &cobra.Command{
- Use: "title <id>",
+ Use: "title [<id>]",
Short: "Display a bug's title",
RunE: runTitle,
}