@@ -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)) {
@@ -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{}
@@ -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 {