Detailed changes
@@ -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)
@@ -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 {
@@ -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 {
@@ -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
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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()
@@ -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 {
@@ -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 ...")
@@ -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 {
@@ -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]
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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)
}
@@ -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 {
@@ -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 {
@@ -1,4 +1,4 @@
-package cleaner
+package interrupt
import (
"fmt"
@@ -12,8 +12,8 @@ type Cleaner func() error
var cleaners []Cleaner
var inactive bool
-// Register a cleaner function. When a function is registered, the Signal watcher is started in a goroutine.
-func Register(f Cleaner) {
+// RegisterCleaner is responsible for regisreting a cleaner function. When a function is registered, the Signal watcher is started in a goroutine.
+func RegisterCleaner(f Cleaner) {
cleaners = append(cleaners, f)
if !inactive {
inactive = false