diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-18 13:28:01 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-18 13:28:01 +0200 |
commit | 544b9cc0c4cc694cdb688b9cad8f9c8542d111fc (patch) | |
tree | b16dd6c9cfeb56d85e8d701b7851bb2dc947ad97 /commands/show.go | |
parent | 5f9fd2a2d95bd23e5d6972ec822bf1fea3077804 (diff) | |
download | git-bug-544b9cc0c4cc694cdb688b9cad8f9c8542d111fc.tar.gz |
commands: convert compatible commands to the implicit select mechanism
Diffstat (limited to 'commands/show.go')
-rw-r--r-- | commands/show.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/commands/show.go b/commands/show.go index d4d1bb54..b1b7b432 100644 --- a/commands/show.go +++ b/commands/show.go @@ -6,28 +6,19 @@ import ( "strings" "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/commands/select" "github.com/MichaelMure/git-bug/util/colors" "github.com/spf13/cobra" ) func runShowBug(cmd *cobra.Command, args []string) error { - if len(args) > 1 { - return errors.New("Only showing one bug at a time 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 } @@ -82,7 +73,7 @@ func runShowBug(cmd *cobra.Command, args []string) error { } var showCmd = &cobra.Command{ - Use: "show <id>", + Use: "show [<id>]", Short: "Display the details of a bug", RunE: runShowBug, } |