diff options
author | Michael Muré <batolettre@gmail.com> | 2024-08-25 20:40:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-25 18:40:23 +0000 |
commit | 3a4b8805dfd794cc25f57e99c73ddec651805af1 (patch) | |
tree | b6af67c761c96b323400d061db22ceed73fb0bb0 /commands/bug | |
parent | c3ff05f95bdfad6c2ea4cb899024fd47ac503b5f (diff) | |
download | git-bug-3a4b8805dfd794cc25f57e99c73ddec651805af1.tar.gz |
core: make label a common type, in a similar fashion as for status (#1252)
This will be useful for Board, and likely code review support later
Diffstat (limited to 'commands/bug')
-rw-r--r-- | commands/bug/bug.go | 3 | ||||
-rw-r--r-- | commands/bug/completion.go | 12 |
2 files changed, 7 insertions, 8 deletions
diff --git a/commands/bug/bug.go b/commands/bug/bug.go index 4cf18ab9..4e696a49 100644 --- a/commands/bug/bug.go +++ b/commands/bug/bug.go @@ -13,7 +13,6 @@ import ( "github.com/git-bug/git-bug/commands/cmdjson" "github.com/git-bug/git-bug/commands/completion" "github.com/git-bug/git-bug/commands/execenv" - "github.com/git-bug/git-bug/entities/bug" "github.com/git-bug/git-bug/entities/common" "github.com/git-bug/git-bug/entity" "github.com/git-bug/git-bug/query" @@ -280,7 +279,7 @@ func bugsPlainFormatter(env *execenv.Env, excerpts []*cache.BugExcerpt) error { func bugsOrgmodeFormatter(env *execenv.Env, excerpts []*cache.BugExcerpt) error { // see https://orgmode.org/manual/Tags.html orgTagRe := regexp.MustCompile("[^[:alpha:]_@]") - formatTag := func(l bug.Label) string { + formatTag := func(l common.Label) string { return orgTagRe.ReplaceAllString(l.String(), "_") } diff --git a/commands/bug/completion.go b/commands/bug/completion.go index d313ef37..4329829e 100644 --- a/commands/bug/completion.go +++ b/commands/bug/completion.go @@ -9,7 +9,7 @@ import ( "github.com/git-bug/git-bug/commands/completion" "github.com/git-bug/git-bug/commands/execenv" _select "github.com/git-bug/git-bug/commands/select" - "github.com/git-bug/git-bug/entities/bug" + "github.com/git-bug/git-bug/entities/common" ) // BugCompletion complete a bug id @@ -61,26 +61,26 @@ func BugAndLabelsCompletion(env *execenv.Env, addOrRemove bool) completion.Valid snap := b.Snapshot() - seenLabels := map[bug.Label]bool{} + seenLabels := map[common.Label]bool{} for _, label := range cleanArgs { - seenLabels[bug.Label(label)] = addOrRemove + seenLabels[common.Label(label)] = addOrRemove } - var labels []bug.Label + var labels []common.Label if addOrRemove { for _, label := range snap.Labels { seenLabels[label] = true } allLabels := env.Backend.Bugs().ValidLabels() - labels = make([]bug.Label, 0, len(allLabels)) + labels = make([]common.Label, 0, len(allLabels)) for _, label := range allLabels { if !seenLabels[label] { labels = append(labels, label) } } } else { - labels = make([]bug.Label, 0, len(snap.Labels)) + labels = make([]common.Label, 0, len(snap.Labels)) for _, label := range snap.Labels { if seenLabels[label] { labels = append(labels, label) |