aboutsummaryrefslogtreecommitdiffstats
path: root/termui
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-31 13:18:03 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-31 17:22:10 +0200
commit7397c94d993541b33e555b758ebdb8f61ff33c6c (patch)
treedbdc52bb6efa03791e5ca84bc8695da5103524d2 /termui
parent116a94401f0d3fbf79f7e20716b1c7b739e33246 (diff)
downloadgit-bug-7397c94d993541b33e555b758ebdb8f61ff33c6c.tar.gz
make CLI commands use the cache to lock the repo properly
Diffstat (limited to 'termui')
-rw-r--r--termui/show_bug.go4
-rw-r--r--termui/termui.go17
2 files changed, 7 insertions, 14 deletions
diff --git a/termui/show_bug.go b/termui/show_bug.go
index 48592fc4..84337c8b 100644
--- a/termui/show_bug.go
+++ b/termui/show_bug.go
@@ -599,7 +599,7 @@ func (sb *showBug) addLabel(g *gocui.Gui, v *gocui.View) error {
return r == ' ' || r == ','
})
- err := sb.bug.ChangeLabels(trimLabels(labels), nil)
+ err := sb.bug.ChangeLabels(nil, trimLabels(labels), nil)
if err != nil {
ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
}
@@ -622,7 +622,7 @@ func (sb *showBug) removeLabel(g *gocui.Gui, v *gocui.View) error {
return r == ' ' || r == ','
})
- err := sb.bug.ChangeLabels(nil, trimLabels(labels))
+ err := sb.bug.ChangeLabels(nil, nil, trimLabels(labels))
if err != nil {
ui.msgPopup.Activate(msgPopupErrorTitle, err.Error())
}
diff --git a/termui/termui.go b/termui/termui.go
index 91e92f00..581db670 100644
--- a/termui/termui.go
+++ b/termui/termui.go
@@ -3,7 +3,6 @@ package termui
import (
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/input"
- "github.com/MichaelMure/git-bug/repository"
"github.com/jroimartin/gocui"
"github.com/pkg/errors"
)
@@ -42,18 +41,12 @@ type window interface {
}
// Run will launch the termUI in the terminal
-func Run(repo repository.Repo) error {
- c, err := cache.NewRepoCache(repo)
-
- if err != nil {
- return err
- }
-
+func Run(cache *cache.RepoCache) error {
ui = &termUI{
gError: make(chan error, 1),
- cache: c,
- bugTable: newBugTable(c),
- showBug: newShowBug(c),
+ cache: cache,
+ bugTable: newBugTable(cache),
+ showBug: newShowBug(cache),
msgPopup: newMsgPopup(),
inputPopup: newInputPopup(),
}
@@ -62,7 +55,7 @@ func Run(repo repository.Repo) error {
initGui(nil)
- err = <-ui.gError
+ err := <-ui.gError
if err != nil && err != gocui.ErrQuit {
return err