From c38f8f1c307cf0320ed3d8556cd9dede443fb2a2 Mon Sep 17 00:00:00 2001 From: Rafael Passos Date: Tue, 23 Oct 2018 18:01:00 -0300 Subject: Registering lock clearing functions to Cleaner --- commands/add.go | 2 ++ commands/bridge.go | 2 ++ commands/bridge_configure.go | 2 ++ commands/bridge_pull.go | 2 ++ commands/bridge_rm.go | 2 ++ commands/comment.go | 2 ++ commands/comment_add.go | 2 ++ commands/deselect.go | 2 ++ commands/label.go | 2 ++ commands/label_add.go | 2 ++ commands/label_rm.go | 2 ++ commands/ls-labels.go | 2 ++ commands/ls.go | 2 ++ commands/pull.go | 2 ++ commands/push.go | 2 ++ commands/select.go | 2 ++ commands/show.go | 2 ++ commands/status.go | 2 ++ commands/status_close.go | 2 ++ commands/status_open.go | 2 ++ commands/termui.go | 2 ++ commands/title.go | 2 ++ commands/title_edit.go | 2 ++ 23 files changed, 46 insertions(+) (limited to 'commands') 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 { -- cgit From f72b18496b508c23cee6fa99d764cfe59208515c Mon Sep 17 00:00:00 2001 From: Rafael Passos Date: Wed, 24 Oct 2018 18:36:39 -0300 Subject: moved cleaner function to util/interrupt --- commands/add.go | 4 ++-- commands/bridge.go | 4 ++-- commands/bridge_configure.go | 4 ++-- commands/bridge_pull.go | 4 ++-- commands/bridge_rm.go | 4 ++-- commands/comment.go | 4 ++-- commands/comment_add.go | 4 ++-- commands/deselect.go | 4 ++-- commands/label.go | 4 ++-- commands/label_add.go | 4 ++-- commands/label_rm.go | 4 ++-- commands/ls-labels.go | 4 ++-- commands/ls.go | 4 ++-- commands/pull.go | 4 ++-- commands/push.go | 4 ++-- commands/select.go | 4 ++-- commands/show.go | 4 ++-- commands/status.go | 4 ++-- commands/status_close.go | 4 ++-- commands/status_open.go | 4 ++-- commands/termui.go | 4 ++-- commands/title.go | 4 ++-- commands/title_edit.go | 4 ++-- 23 files changed, 46 insertions(+), 46 deletions(-) (limited to 'commands') diff --git a/commands/add.go b/commands/add.go index e2650406..54ede126 100644 --- a/commands/add.go +++ b/commands/add.go @@ -4,8 +4,8 @@ import ( "fmt" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" "github.com/MichaelMure/git-bug/input" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -23,7 +23,7 @@ func runAddBug(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) if addMessageFile != "" && addMessage == "" { addTitle, addMessage, err = input.BugCreateFileInput(addMessageFile) diff --git a/commands/bridge.go b/commands/bridge.go index ffba2b9d..a473776d 100644 --- a/commands/bridge.go +++ b/commands/bridge.go @@ -5,7 +5,7 @@ import ( "github.com/MichaelMure/git-bug/bridge" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runBridge(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) configured, err := bridge.ConfiguredBridges(backend) if err != nil { diff --git a/commands/bridge_configure.go b/commands/bridge_configure.go index c4d41c74..ef499f1f 100644 --- a/commands/bridge_configure.go +++ b/commands/bridge_configure.go @@ -9,7 +9,7 @@ import ( "github.com/MichaelMure/git-bug/bridge" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -19,7 +19,7 @@ func runBridgeConfigure(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) target, err := promptTarget() if err != nil { diff --git a/commands/bridge_pull.go b/commands/bridge_pull.go index f7e2acf0..669a6713 100644 --- a/commands/bridge_pull.go +++ b/commands/bridge_pull.go @@ -4,7 +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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -14,7 +14,7 @@ func runBridgePull(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) var b *core.Bridge diff --git a/commands/bridge_rm.go b/commands/bridge_rm.go index 92f1b3c5..172fc0d8 100644 --- a/commands/bridge_rm.go +++ b/commands/bridge_rm.go @@ -3,7 +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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func runBridgeRm(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) err = bridge.RemoveBridges(backend, args[0]) if err != nil { diff --git a/commands/comment.go b/commands/comment.go index f644a23f..89378da3 100644 --- a/commands/comment.go +++ b/commands/comment.go @@ -5,9 +5,9 @@ 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/interrupt" "github.com/MichaelMure/git-bug/util/text" "github.com/spf13/cobra" ) @@ -18,7 +18,7 @@ func runComment(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 3266e941..58408bc5 100644 --- a/commands/comment_add.go +++ b/commands/comment_add.go @@ -4,9 +4,9 @@ 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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ func runCommentAdd(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) b, args, err := _select.ResolveBug(backend, args) if err != nil { diff --git a/commands/deselect.go b/commands/deselect.go index d04e7bc1..210f158c 100644 --- a/commands/deselect.go +++ b/commands/deselect.go @@ -2,8 +2,8 @@ package commands import ( "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/interrupt" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func runDeselect(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) err = _select.Clear(backend) if err != nil { diff --git a/commands/label.go b/commands/label.go index 75a034f8..58ccc299 100644 --- a/commands/label.go +++ b/commands/label.go @@ -4,8 +4,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runLabel(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 4fe6b327..f04ed7d6 100644 --- a/commands/label_add.go +++ b/commands/label_add.go @@ -4,8 +4,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runLabelAdd(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 b8cc9620..36051ba1 100644 --- a/commands/label_rm.go +++ b/commands/label_rm.go @@ -4,8 +4,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runLabelRm(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 525303e0..ef2c95bc 100644 --- a/commands/ls-labels.go +++ b/commands/ls-labels.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -14,7 +14,7 @@ func runLsLabel(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) labels := backend.ValidLabels() diff --git a/commands/ls.go b/commands/ls.go index a25aa582..2f621bc5 100644 --- a/commands/ls.go +++ b/commands/ls.go @@ -6,8 +6,8 @@ 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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -26,7 +26,7 @@ func runLsBug(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) var query *cache.Query if len(args) >= 1 { diff --git a/commands/pull.go b/commands/pull.go index cfdcd771..67c2a339 100644 --- a/commands/pull.go +++ b/commands/pull.go @@ -6,7 +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/interrupt" "github.com/spf13/cobra" ) @@ -25,7 +25,7 @@ func runPull(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) fmt.Println("Fetching remote ...") diff --git a/commands/push.go b/commands/push.go index 599b5557..0477be60 100644 --- a/commands/push.go +++ b/commands/push.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -24,7 +24,7 @@ func runPush(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) stdout, err := backend.Push(remote) if err != nil { diff --git a/commands/select.go b/commands/select.go index a519d921..cc688354 100644 --- a/commands/select.go +++ b/commands/select.go @@ -5,8 +5,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ func runSelect(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) prefix := args[0] diff --git a/commands/show.go b/commands/show.go index d6c05d87..86c01a17 100644 --- a/commands/show.go +++ b/commands/show.go @@ -6,9 +6,9 @@ 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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -18,7 +18,7 @@ func runShowBug(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) b, args, err := _select.ResolveBug(backend, args) if err != nil { diff --git a/commands/status.go b/commands/status.go index bdd6dd4a..7928628a 100644 --- a/commands/status.go +++ b/commands/status.go @@ -4,8 +4,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runStatus(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 823d98b5..2b4f9602 100644 --- a/commands/status_close.go +++ b/commands/status_close.go @@ -2,8 +2,8 @@ package commands import ( "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/interrupt" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func runStatusClose(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 0413d2b7..5e3029e2 100644 --- a/commands/status_open.go +++ b/commands/status_open.go @@ -2,8 +2,8 @@ package commands import ( "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/interrupt" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func runStatusOpen(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) b, args, err := _select.ResolveBug(backend, args) if err != nil { diff --git a/commands/termui.go b/commands/termui.go index d3dbc733..4a029d6c 100644 --- a/commands/termui.go +++ b/commands/termui.go @@ -2,8 +2,8 @@ package commands import ( "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/cleaner" "github.com/MichaelMure/git-bug/termui" + "github.com/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -13,7 +13,7 @@ func runTermUI(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) return termui.Run(backend) } diff --git a/commands/title.go b/commands/title.go index 37db03dd..c9157a70 100644 --- a/commands/title.go +++ b/commands/title.go @@ -4,8 +4,8 @@ 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/util/interrupt" "github.com/spf13/cobra" ) @@ -15,7 +15,7 @@ func runTitle(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(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 de9a55ab..6bbd1b0a 100644 --- a/commands/title_edit.go +++ b/commands/title_edit.go @@ -4,9 +4,9 @@ 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/MichaelMure/git-bug/util/interrupt" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ func runTitleEdit(cmd *cobra.Command, args []string) error { return err } defer backend.Close() - cleaner.Register(backend.Close) + interrupt.RegisterCleaner(backend.Close) b, args, err := _select.ResolveBug(backend, args) if err != nil { -- cgit