diff options
author | vince <vincetiu8@gmail.com> | 2020-07-21 11:41:46 +0800 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-07-28 14:30:06 +0200 |
commit | 9436cf4b8983699ef7a164f4036686dd83d345d4 (patch) | |
tree | 4117b85ef19a3526cda1bbd36a5c90fb679f8db5 /cache/repo_cache_bug.go | |
parent | 7dbcca84c7a0b6658463e3e54690b8860b662b6e (diff) | |
download | git-bug-9436cf4b8983699ef7a164f4036686dd83d345d4.tar.gz |
Move args parsing out of repo cache
Diffstat (limited to 'cache/repo_cache_bug.go')
-rw-r--r-- | cache/repo_cache_bug.go | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/cache/repo_cache_bug.go b/cache/repo_cache_bug.go index 0c26cb38..c7e2ed34 100644 --- a/cache/repo_cache_bug.go +++ b/cache/repo_cache_bug.go @@ -363,21 +363,17 @@ func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title strin // RemoveBug removes a bug from the cache and repo // 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]) +func (c *RepoCache) RemoveBug(prefix string, remote string) error { + b, err := c.ResolveBugPrefix(prefix) if err != nil { return err } - if len(args) == 1 { + if remote == "" { err = bug.RemoveLocalBug(c.repo, b.Id()) } else { - err = bug.RemoveRemoteBug(c.repo, args[1], b.Id()) + err = bug.RemoveRemoteBug(c.repo, remote, b.Id()) } if err != nil { return err |