MCPcopy Index your code
hub / github.com/git-bug/git-bug / SetBug

Method SetBug

termui/label_select.go:37–62  ·  view source on GitHub ↗
(cache *cache.RepoCache, bug *cache.BugCache)

Source from the content-addressed store, hash-verified

35}
36
37func (ls *labelSelect) SetBug(cache *cache.RepoCache, bug *cache.BugCache) {
38 ls.cache = cache
39 ls.bug = bug
40 ls.labels = cache.Bugs().ValidLabels()
41
42 // Find which labels are currently applied to the bug
43 bugLabels := bug.Snapshot().Labels
44 labelSelect := make([]bool, len(ls.labels))
45 for i, label := range ls.labels {
46 for _, bugLabel := range bugLabels {
47 if label == bugLabel {
48 labelSelect[i] = true
49 break
50 }
51 }
52 }
53
54 ls.labelSelect = labelSelect
55 if len(labelSelect) > 0 {
56 ls.selected = 0
57 } else {
58 ls.selected = -1
59 }
60
61 ls.scroll = 0
62}
63
64func (ls *labelSelect) keybindings(g *gocui.Gui) error {
65 // Abort

Callers

nothing calls this directly

Calls 3

BugsMethod · 0.80
SnapshotMethod · 0.80
ValidLabelsMethod · 0.65

Tested by

no test coverage detected