diff options
Diffstat (limited to 'commands/title.go')
-rw-r--r-- | commands/title.go | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/commands/title.go b/commands/title.go index c1a0e7fb..d11fb40e 100644 --- a/commands/title.go +++ b/commands/title.go @@ -3,18 +3,17 @@ package commands import ( "github.com/spf13/cobra" - "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/commands/select" - "github.com/MichaelMure/git-bug/util/interrupt" ) func newTitleCommand() *cobra.Command { env := newEnv() cmd := &cobra.Command{ - Use: "title [<id>]", - Short: "Display or change a title of a bug.", - PreRunE: loadRepo(env), + Use: "title [<id>]", + Short: "Display or change a title of a bug.", + PreRunE: loadBackend(env), + PostRunE: closeBackend(env), RunE: func(cmd *cobra.Command, args []string) error { return runTitle(env, args) }, @@ -26,14 +25,7 @@ func newTitleCommand() *cobra.Command { } func runTitle(env *Env, args []string) error { - backend, err := cache.NewRepoCache(env.repo) - if err != nil { - return err - } - defer backend.Close() - interrupt.RegisterCleaner(backend.Close) - - b, args, err := _select.ResolveBug(backend, args) + b, args, err := _select.ResolveBug(env.backend, args) if err != nil { return err } |