From 4e4ca106aea25da74f1df49d33f4eaa272a6e8f0 Mon Sep 17 00:00:00 2001 From: vince Date: Mon, 20 Jul 2020 09:55:14 +0800 Subject: Allow user to delete remote bugs --- cache/repo_cache_bug.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'cache') diff --git a/cache/repo_cache_bug.go b/cache/repo_cache_bug.go index 0492e7f1..0c26cb38 100644 --- a/cache/repo_cache_bug.go +++ b/cache/repo_cache_bug.go @@ -361,13 +361,24 @@ func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title strin } // RemoveBug removes a bug from the cache and repo -func (c *RepoCache) RemoveBug(prefix string) error { - b, err := c.ResolveBugPrefix(prefix) +// args[0] specifies the bug prefix to remove +// args[1] (if present) specifies the remote the bug was imported from +func (c *RepoCache) RemoveBug(args []string) error { + if len(args) == 0 { + return fmt.Errorf("you must provide a bug prefix to remove") + } + + b, err := c.ResolveBugPrefix(args[0]) + if err != nil { return err } - err = bug.RemoveLocalBug(c.repo, b.Id()) + if len(args) == 1 { + err = bug.RemoveLocalBug(c.repo, b.Id()) + } else { + err = bug.RemoveRemoteBug(c.repo, args[1], b.Id()) + } if err != nil { return err } -- cgit