aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Passos <rafael@rcpassos.me>2018-10-23 18:01:00 -0300
committerRafael Passos <rafael@rcpassos.me>2018-10-23 18:01:00 -0300
commitc38f8f1c307cf0320ed3d8556cd9dede443fb2a2 (patch)
treeff88ec470d62821005a52dbc08320414dfeb3492
parentaddeb9a0a1114136c5bc5773724a19d6be377c9d (diff)
downloadgit-bug-c38f8f1c307cf0320ed3d8556cd9dede443fb2a2.tar.gz
Registering lock clearing functions to Cleaner
-rw-r--r--commands/add.go2
-rw-r--r--commands/bridge.go2
-rw-r--r--commands/bridge_configure.go2
-rw-r--r--commands/bridge_pull.go2
-rw-r--r--commands/bridge_rm.go2
-rw-r--r--commands/comment.go2
-rw-r--r--commands/comment_add.go2
-rw-r--r--commands/deselect.go2
-rw-r--r--commands/label.go2
-rw-r--r--commands/label_add.go2
-rw-r--r--commands/label_rm.go2
-rw-r--r--commands/ls-labels.go2
-rw-r--r--commands/ls.go2
-rw-r--r--commands/pull.go2
-rw-r--r--commands/push.go2
-rw-r--r--commands/select.go2
-rw-r--r--commands/show.go2
-rw-r--r--commands/status.go2
-rw-r--r--commands/status_close.go2
-rw-r--r--commands/status_open.go2
-rw-r--r--commands/termui.go2
-rw-r--r--commands/title.go2
-rw-r--r--commands/title_edit.go2
23 files changed, 46 insertions, 0 deletions
diff --git a/commands/add.go b/commands/add.go
index ecc2381e..e2650406 100644
--- a/commands/add.go
+++ b/commands/add.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/input"
"github.com/spf13/cobra"
)
@@ -22,6 +23,7 @@ func runAddBug(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
if addMessageFile != "" && addMessage == "" {
addTitle, addMessage, err = input.BugCreateFileInput(addMessageFile)
diff --git a/commands/bridge.go b/commands/bridge.go
index 4576cd0a..ffba2b9d 100644
--- a/commands/bridge.go
+++ b/commands/bridge.go
@@ -5,6 +5,7 @@ import (
"github.com/MichaelMure/git-bug/bridge"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runBridge(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
configured, err := bridge.ConfiguredBridges(backend)
if err != nil {
diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go
index ed18cae9..c4d41c74 100644
--- a/commands/bridge_configure.go
+++ b/commands/bridge_configure.go
@@ -9,6 +9,7 @@ import (
"github.com/MichaelMure/git-bug/bridge"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -18,6 +19,7 @@ func runBridgeConfigure(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
target, err := promptTarget()
if err != nil {
diff --git a/commands/bridge_pull.go b/commands/bridge_pull.go
index a90a533f..f7e2acf0 100644
--- a/commands/bridge_pull.go
+++ b/commands/bridge_pull.go
@@ -4,6 +4,7 @@ import (
"github.com/MichaelMure/git-bug/bridge"
"github.com/MichaelMure/git-bug/bridge/core"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -13,6 +14,7 @@ func runBridgePull(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
var b *core.Bridge
diff --git a/commands/bridge_rm.go b/commands/bridge_rm.go
index 2ebc17a7..92f1b3c5 100644
--- a/commands/bridge_rm.go
+++ b/commands/bridge_rm.go
@@ -3,6 +3,7 @@ package commands
import (
"github.com/MichaelMure/git-bug/bridge"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -12,6 +13,7 @@ func runBridgeRm(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
err = bridge.RemoveBridges(backend, args[0])
if err != nil {
diff --git a/commands/comment.go b/commands/comment.go
index fc4b6a6b..f644a23f 100644
--- a/commands/comment.go
+++ b/commands/comment.go
@@ -5,6 +5,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/MichaelMure/git-bug/util/text"
@@ -17,6 +18,7 @@ func runComment(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/comment_add.go b/commands/comment_add.go
index d0912844..3266e941 100644
--- a/commands/comment_add.go
+++ b/commands/comment_add.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/input"
"github.com/spf13/cobra"
@@ -20,6 +21,7 @@ func runCommentAdd(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/deselect.go b/commands/deselect.go
index a2e8d30d..d04e7bc1 100644
--- a/commands/deselect.go
+++ b/commands/deselect.go
@@ -2,6 +2,7 @@ package commands
import (
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -12,6 +13,7 @@ func runDeselect(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
err = _select.Clear(backend)
if err != nil {
diff --git a/commands/label.go b/commands/label.go
index 0221701c..75a034f8 100644
--- a/commands/label.go
+++ b/commands/label.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runLabel(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/label_add.go b/commands/label_add.go
index 278d6472..4fe6b327 100644
--- a/commands/label_add.go
+++ b/commands/label_add.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runLabelAdd(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/label_rm.go b/commands/label_rm.go
index e53ac09a..b8cc9620 100644
--- a/commands/label_rm.go
+++ b/commands/label_rm.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runLabelRm(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/ls-labels.go b/commands/ls-labels.go
index 9dd94f08..525303e0 100644
--- a/commands/ls-labels.go
+++ b/commands/ls-labels.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -13,6 +14,7 @@ func runLsLabel(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
labels := backend.ValidLabels()
diff --git a/commands/ls.go b/commands/ls.go
index 1a759a26..a25aa582 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -6,6 +6,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/spf13/cobra"
)
@@ -25,6 +26,7 @@ func runLsBug(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
var query *cache.Query
if len(args) >= 1 {
diff --git a/commands/pull.go b/commands/pull.go
index 27c0953b..cfdcd771 100644
--- a/commands/pull.go
+++ b/commands/pull.go
@@ -6,6 +6,7 @@ import (
"github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -24,6 +25,7 @@ func runPull(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
fmt.Println("Fetching remote ...")
diff --git a/commands/push.go b/commands/push.go
index 11282ada..599b5557 100644
--- a/commands/push.go
+++ b/commands/push.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/spf13/cobra"
)
@@ -23,6 +24,7 @@ func runPush(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
stdout, err := backend.Push(remote)
if err != nil {
diff --git a/commands/select.go b/commands/select.go
index 0c50d1a6..a519d921 100644
--- a/commands/select.go
+++ b/commands/select.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -19,6 +20,7 @@ func runSelect(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
prefix := args[0]
diff --git a/commands/show.go b/commands/show.go
index c41af02d..d6c05d87 100644
--- a/commands/show.go
+++ b/commands/show.go
@@ -6,6 +6,7 @@ import (
"strings"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/util/colors"
"github.com/spf13/cobra"
@@ -17,6 +18,7 @@ func runShowBug(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/status.go b/commands/status.go
index 6aed000a..bdd6dd4a 100644
--- a/commands/status.go
+++ b/commands/status.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runStatus(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/status_close.go b/commands/status_close.go
index ec4e503e..823d98b5 100644
--- a/commands/status_close.go
+++ b/commands/status_close.go
@@ -2,6 +2,7 @@ package commands
import (
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -12,6 +13,7 @@ func runStatusClose(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/status_open.go b/commands/status_open.go
index c8717cd2..0413d2b7 100644
--- a/commands/status_open.go
+++ b/commands/status_open.go
@@ -2,6 +2,7 @@ package commands
import (
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -12,6 +13,7 @@ func runStatusOpen(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/termui.go b/commands/termui.go
index 8df5ba7c..d3dbc733 100644
--- a/commands/termui.go
+++ b/commands/termui.go
@@ -2,6 +2,7 @@ package commands
import (
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/termui"
"github.com/spf13/cobra"
)
@@ -12,6 +13,7 @@ func runTermUI(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
return termui.Run(backend)
}
diff --git a/commands/title.go b/commands/title.go
index 5d723755..37db03dd 100644
--- a/commands/title.go
+++ b/commands/title.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/spf13/cobra"
)
@@ -14,6 +15,7 @@ func runTitle(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {
diff --git a/commands/title_edit.go b/commands/title_edit.go
index f3b93bb1..de9a55ab 100644
--- a/commands/title_edit.go
+++ b/commands/title_edit.go
@@ -4,6 +4,7 @@ import (
"fmt"
"github.com/MichaelMure/git-bug/cache"
+ "github.com/MichaelMure/git-bug/cleaner"
"github.com/MichaelMure/git-bug/commands/select"
"github.com/MichaelMure/git-bug/input"
"github.com/spf13/cobra"
@@ -19,6 +20,7 @@ func runTitleEdit(cmd *cobra.Command, args []string) error {
return err
}
defer backend.Close()
+ cleaner.Register(backend.Close)
b, args, err := _select.ResolveBug(backend, args)
if err != nil {