aboutsummaryrefslogtreecommitdiffstats
path: root/cache
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-31 16:43:43 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-31 16:44:23 +0200
commit87669e0f18f282854d340a676834b939e34e5ed3 (patch)
treec78eaa155d2939d6647ab814c6710d0d3ed69a6e /cache
parenteb39c5c29bc0e9b5e15a940a1b71bdac688b6535 (diff)
downloadgit-bug-87669e0f18f282854d340a676834b939e34e5ed3.tar.gz
termui: use the editor to create a new bug
Diffstat (limited to 'cache')
-rw-r--r--cache/cache.go19
1 files changed, 12 insertions, 7 deletions
diff --git a/cache/cache.go b/cache/cache.go
index 2813b150..b46ea83f 100644
--- a/cache/cache.go
+++ b/cache/cache.go
@@ -22,6 +22,7 @@ type Cacher interface {
}
type RepoCacher interface {
+ Repository() repository.Repo
ResolveBug(id string) (BugCacher, error)
ResolveBugPrefix(prefix string) (BugCacher, error)
AllBugIds() ([]string, error)
@@ -111,7 +112,11 @@ func NewRepoCache(r repository.Repo) RepoCacher {
}
}
-func (c RepoCache) ResolveBug(id string) (BugCacher, error) {
+func (c *RepoCache) Repository() repository.Repo {
+ return c.repo
+}
+
+func (c *RepoCache) ResolveBug(id string) (BugCacher, error) {
cached, ok := c.bugs[id]
if ok {
return cached, nil
@@ -128,7 +133,7 @@ func (c RepoCache) ResolveBug(id string) (BugCacher, error) {
return cached, nil
}
-func (c RepoCache) ResolveBugPrefix(prefix string) (BugCacher, error) {
+func (c *RepoCache) ResolveBugPrefix(prefix string) (BugCacher, error) {
// preallocate but empty
matching := make([]string, 0, 5)
@@ -161,15 +166,15 @@ func (c RepoCache) ResolveBugPrefix(prefix string) (BugCacher, error) {
return cached, nil
}
-func (c RepoCache) AllBugIds() ([]string, error) {
+func (c *RepoCache) AllBugIds() ([]string, error) {
return bug.ListLocalIds(c.repo)
}
-func (c RepoCache) ClearAllBugs() {
+func (c *RepoCache) ClearAllBugs() {
c.bugs = make(map[string]BugCacher)
}
-func (c RepoCache) NewBug(title string, message string) (BugCacher, error) {
+func (c *RepoCache) NewBug(title string, message string) (BugCacher, error) {
author, err := bug.GetUser(c.repo)
if err != nil {
return nil, err
@@ -204,7 +209,7 @@ func NewBugCache(b *bug.Bug) BugCacher {
}
}
-func (c BugCache) Snapshot() *bug.Snapshot {
+func (c *BugCache) Snapshot() *bug.Snapshot {
if c.snap == nil {
snap := c.bug.Compile()
c.snap = &snap
@@ -212,6 +217,6 @@ func (c BugCache) Snapshot() *bug.Snapshot {
return c.snap
}
-func (c BugCache) ClearSnapshot() {
+func (c *BugCache) ClearSnapshot() {
c.snap = nil
}