diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-31 13:18:03 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-31 17:22:10 +0200 |
commit | 7397c94d993541b33e555b758ebdb8f61ff33c6c (patch) | |
tree | dbdc52bb6efa03791e5ca84bc8695da5103524d2 /commands/close.go | |
parent | 116a94401f0d3fbf79f7e20716b1c7b739e33246 (diff) | |
download | git-bug-7397c94d993541b33e555b758ebdb8f61ff33c6c.tar.gz |
make CLI commands use the cache to lock the repo properly
Diffstat (limited to 'commands/close.go')
-rw-r--r-- | commands/close.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/commands/close.go b/commands/close.go index 10420a4e..890702dd 100644 --- a/commands/close.go +++ b/commands/close.go @@ -3,8 +3,7 @@ package commands import ( "errors" - "github.com/MichaelMure/git-bug/bug" - "github.com/MichaelMure/git-bug/bug/operations" + "github.com/MichaelMure/git-bug/cache" "github.com/spf13/cobra" ) @@ -17,21 +16,25 @@ func runCloseBug(cmd *cobra.Command, args []string) error { 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 := bug.FindLocalBug(repo, prefix) + b, err := backend.ResolveBugPrefix(prefix) if err != nil { return err } - author, err := bug.GetUser(repo) + err = b.Close() if err != nil { return err } - operations.Close(b, author) - - return b.Commit(repo) + return b.Commit() } var closeCmd = &cobra.Command{ |