From 544b9cc0c4cc694cdb688b9cad8f9c8542d111fc Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 18 Sep 2018 13:28:01 +0200 Subject: commands: convert compatible commands to the implicit select mechanism --- commands/status_close.go | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'commands/status_close.go') diff --git a/commands/status_close.go b/commands/status_close.go index 55e47c22..de8b990c 100644 --- a/commands/status_close.go +++ b/commands/status_close.go @@ -1,30 +1,19 @@ package commands import ( - "errors" - "github.com/MichaelMure/git-bug/cache" + "github.com/MichaelMure/git-bug/commands/select" "github.com/spf13/cobra" ) func runStatusClose(cmd *cobra.Command, args []string) error { - if len(args) > 1 { - return errors.New("Only closing 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 } @@ -38,7 +27,7 @@ func runStatusClose(cmd *cobra.Command, args []string) error { } var closeCmd = &cobra.Command{ - Use: "close ", + Use: "close []", Short: "Mark the bug as closed", RunE: runStatusClose, } -- cgit