diff --git a/commands/add.go b/commands/add.go index ecc2381ea0141354827e92bff78a79f2da5f5111..e2650406b3be6165431e6a007ddc13719291d292 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 4576cd0aac1c5537157300aeeab7e4e97e9d007d..ffba2b9d8c94d24b98f4734cd1b6cfae3ba7fdbd 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 ed18cae9df2f9707a1f74282f0a1ee2cebfb56a9..c4d41c742266104851b23cf7850d1e764748f6a7 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 a90a533f03b088f52694829664e71527ea692d55..f7e2acf050bc02d134aed21c18aae4390e83600a 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 2ebc17a7a47fce533a3db6f0940173ef3d1112b0..92f1b3c50713f242d03a78bf97a10293730ca91c 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 fc4b6a6b24d566db65ce874aedcea2f2d69a57c2..f644a23f35f1ec91711e6887316bee844d52413c 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 d09128448ad5e73eb2fe21105dcb38cdc9fa512e..3266e9414f95595ec92f75e4fa65df167eba9666 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 a2e8d30d65057c6605c1478fcbcf74e555f5b829..d04e7bc1a5653927cb917b00bfc36f92d2464141 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 0221701ca2ac62a0531d2a250b9943c0967b7851..75a034f84ffd283fa2188d44a03ea386252f4cdd 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 278d64721e977f2611af828d7ce7e1d56d1248de..4fe6b3279366bd0e74ee5892b3c5b13ad84880bd 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 e53ac09a0997bfffb0a3fc37ad7d49a9f06fb459..b8cc9620854c874119370216f78d876422ce8f98 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 9dd94f081d6b6f09bc3c79183fb45092733609b5..525303e00aeb31521286abf5ff0067b101e53098 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 1a759a264769f959860ebc7e72afdc467f7b42b0..a25aa5829afc4f304b04525391bd8d4616d664d3 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 27c0953ba79ef8f8555495903a3483d4e04867ab..cfdcd7719576e72ce9d035a313826e09e5f851ce 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 11282ada4c42e5b6da4389daf90113c8fc1ed87d..599b55574a66e6d7105d26633b9a18df9d5efb44 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 0c50d1a6bd73676df18f0d2bbc27e41b7bc9b631..a519d921da3fdb32f5a6e2dbcadb1f58bd2cdd92 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 c41af02daa2252796fe9fc1f236cf55286f0176a..d6c05d87f6c5394de58e40fa96e919f844d2f2ae 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 6aed000a6fe42724734d6ec58b0d5864ffd727a7..bdd6dd4a8222ed67d99a7d7fa5054a6a697439e2 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 ec4e503eff736ce444b65a524b4262daa45755a2..823d98b5d06aca153cd33838e3d153999eb42f44 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 c8717cd2f90f7dae2812ec01628e92f9f6d70fae..0413d2b708a32c9f79bcebe46c084d1baf4e133e 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 8df5ba7c0bb9bcc37bbaff147a145db57b5bdf5f..d3dbc7330a3bf41b671493be48edef229ad1a8a6 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 5d7237551d62486e123911ace45757d6bef73fb1..37db03ddeb3ad8b413d63db288c54df25e994542 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 f3b93bb1d635b67e4c15f950ee070dfeb98ee55f..de9a55ab916a822033966dacef309a7c5ab30d00 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 {