diff options
author | Steve Moyer <smoyer1@selesy.com> | 2023-01-03 08:37:21 -0500 |
---|---|---|
committer | Steve Moyer <smoyer1@selesy.com> | 2023-01-03 08:37:21 -0500 |
commit | 7601e79d2b60315e259f36e96d7bfdcc92d3fcba (patch) | |
tree | e84c2c8f33d7610ea83da9a8c2ed774a8da0fa48 /commands/bug/bug.go | |
parent | 344438b9cb216dd878221600071d3ac8093ad34b (diff) | |
parent | 3915d2b76e17ae7058510d3b4cd91b24786bb526 (diff) | |
download | git-bug-7601e79d2b60315e259f36e96d7bfdcc92d3fcba.tar.gz |
deps: fix merge conflicts in dependencies
Diffstat (limited to 'commands/bug/bug.go')
-rw-r--r-- | commands/bug/bug.go | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/commands/bug/bug.go b/commands/bug/bug.go index bab040d8..a5ce11ed 100644 --- a/commands/bug/bug.go +++ b/commands/bug/bug.go @@ -1,7 +1,6 @@ package bugcmd import ( - "encoding/json" "fmt" "regexp" "strings" @@ -187,67 +186,16 @@ func repairQuery(args []string) string { return strings.Join(args, " ") } -type JSONBugExcerpt struct { - Id string `json:"id"` - HumanId string `json:"human_id"` - CreateTime cmdjson.Time `json:"create_time"` - EditTime cmdjson.Time `json:"edit_time"` - - Status string `json:"status"` - Labels []bug.Label `json:"labels"` - Title string `json:"title"` - Actors []cmdjson.Identity `json:"actors"` - Participants []cmdjson.Identity `json:"participants"` - Author cmdjson.Identity `json:"author"` - - Comments int `json:"comments"` - Metadata map[string]string `json:"metadata"` -} - func bugsJsonFormatter(env *execenv.Env, bugExcerpts []*cache.BugExcerpt) error { - jsonBugs := make([]JSONBugExcerpt, len(bugExcerpts)) + jsonBugs := make([]cmdjson.BugExcerpt, len(bugExcerpts)) for i, b := range bugExcerpts { - jsonBug := JSONBugExcerpt{ - Id: b.Id().String(), - HumanId: b.Id().Human(), - CreateTime: cmdjson.NewTime(b.CreateTime(), b.CreateLamportTime), - EditTime: cmdjson.NewTime(b.EditTime(), b.EditLamportTime), - Status: b.Status.String(), - Labels: b.Labels, - Title: b.Title, - Comments: b.LenComments, - Metadata: b.CreateMetadata, - } - - author, err := env.Backend.Identities().ResolveExcerpt(b.AuthorId) + jsonBug, err := cmdjson.NewBugExcerpt(env.Backend, b) if err != nil { return err } - jsonBug.Author = cmdjson.NewIdentityFromExcerpt(author) - - jsonBug.Actors = make([]cmdjson.Identity, len(b.Actors)) - for i, element := range b.Actors { - actor, err := env.Backend.Identities().ResolveExcerpt(element) - if err != nil { - return err - } - jsonBug.Actors[i] = cmdjson.NewIdentityFromExcerpt(actor) - } - - jsonBug.Participants = make([]cmdjson.Identity, len(b.Participants)) - for i, element := range b.Participants { - participant, err := env.Backend.Identities().ResolveExcerpt(element) - if err != nil { - return err - } - jsonBug.Participants[i] = cmdjson.NewIdentityFromExcerpt(participant) - } - jsonBugs[i] = jsonBug } - jsonObject, _ := json.MarshalIndent(jsonBugs, "", " ") - env.Out.Printf("%s\n", jsonObject) - return nil + return env.Out.PrintJSON(jsonBugs) } func bugsCompactFormatter(env *execenv.Env, bugExcerpts []*cache.BugExcerpt) error { |