diff --git a/commands/bug/completion.go b/commands/bug/completion.go index f04468a87eb60f510c07dc7877e155e249ad111b..4764ee4c506654a337a0a79b3d9777763c3a0993 100644 --- a/commands/bug/completion.go +++ b/commands/bug/completion.go @@ -12,7 +12,7 @@ import ( "github.com/git-bug/git-bug/entities/common" ) -// BugCompletion perform bug completion (id, title) on the environment backend +// BugCompletion perform bug completion (id) on the environment backend func BugCompletion(env *execenv.Env) completion.ValidArgsFunction { return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { if err := execenv.LoadBackend(env)(cmd, args); err != nil { @@ -26,7 +26,7 @@ func BugCompletion(env *execenv.Env) completion.ValidArgsFunction { } } -// BugWithBackend perform bug completion (id, title) on the given backend +// BugWithBackend perform bug completion (id) on the given backend func BugWithBackend(backend *cache.RepoCache, toComplete string) (completions []string, directives cobra.ShellCompDirective) { for _, id := range backend.Bugs().AllIds() { if strings.Contains(id.String(), strings.TrimSpace(toComplete)) { diff --git a/entities/board/snapshot.go b/entities/board/snapshot.go index 9a87709f2847f69eaefd812084c5b96d6529d612..0065aed71ccd837ea28d4e067f09ca14cd8b5532 100644 --- a/entities/board/snapshot.go +++ b/entities/board/snapshot.go @@ -18,14 +18,22 @@ type Column struct { Items []Item } +// Item is the interface that board item (draft, bug ...) need to implement. type Item interface { + // CombinedId returns the global identifier of the item. CombinedId() entity.CombinedId + // Author returns the author of the item. Author() identity.Interface + + // Title returns the title of the item. Title() string - // TODO: all items have status? + // TODO: add status, show bug's status, draft has no status // Status() common.Status + + // TODO: add labels, show bug's label, draft has no label + // Labels() []common.Label } var _ dag.Snapshot = &Snapshot{} diff --git a/misc/random_bugs/create_random_bugs.go b/misc/random_bugs/create_random_bugs.go index a7caf931c10a127c1f110e871815859db5a3125b..af1c6ea5ebae18477b7bc5ad89f18de27baa78f5 100644 --- a/misc/random_bugs/create_random_bugs.go +++ b/misc/random_bugs/create_random_bugs.go @@ -12,7 +12,7 @@ import ( "github.com/git-bug/git-bug/repository" ) -type opsGenerator func(bug.Interface, identity.Interface, int64) +type opsGenerator func(bug.ReadWrite, identity.Interface, int64) type Options struct { BugNumber int @@ -143,25 +143,25 @@ func paragraphs() string { return strings.Replace(p, "\t", "\n\n", -1) } -func comment(b bug.Interface, p identity.Interface, timestamp int64) { +func comment(b bug.ReadWrite, p identity.Interface, timestamp int64) { _, _, _ = bug.AddComment(b, p, timestamp, paragraphs(), nil, nil) } -func title(b bug.Interface, p identity.Interface, timestamp int64) { +func title(b bug.ReadWrite, p identity.Interface, timestamp int64) { _, _ = bug.SetTitle(b, p, timestamp, fake.Sentence(), nil) } -func open(b bug.Interface, p identity.Interface, timestamp int64) { +func open(b bug.ReadWrite, p identity.Interface, timestamp int64) { _, _ = bug.Open(b, p, timestamp, nil) } -func close(b bug.Interface, p identity.Interface, timestamp int64) { +func close(b bug.ReadWrite, p identity.Interface, timestamp int64) { _, _ = bug.Close(b, p, timestamp, nil) } var addedLabels []string -func labels(b bug.Interface, p identity.Interface, timestamp int64) { +func labels(b bug.ReadWrite, p identity.Interface, timestamp int64) { var removed []string nbRemoved := rand.Intn(3) for nbRemoved > 0 && len(addedLabels) > 0 {