MCPcopy Create free account
hub / github.com/driangle/taskmd / outputReportJSON

Function outputReportJSON

apps/cli/internal/cli/report.go:136–169  ·  view source on GitHub ↗
(data *reportData, outFile *os.File)

Source from the content-addressed store, hash-verified

134}
135
136func outputReportJSON(data *reportData, outFile *os.File) error {
137 type reportJSON struct {
138 Summary any `json:"summary"`
139 Groups []board.JSONGroup `json:"groups"`
140 GroupBy string `json:"group_by"`
141 CriticalPath []ReportTaskJSON `json:"critical_path"`
142 BlockedTasks []ReportTaskJSON `json:"blocked_tasks"`
143 Graph map[string]any `json:"graph,omitempty"`
144 }
145
146 cpTasks := make([]ReportTaskJSON, len(data.CriticalPath))
147 for i, t := range data.CriticalPath {
148 cpTasks[i] = taskToReportJSON(t)
149 }
150
151 blockedTasks := make([]ReportTaskJSON, len(data.BlockedTasks))
152 for i, t := range data.BlockedTasks {
153 blockedTasks[i] = taskToReportJSON(t)
154 }
155
156 rj := reportJSON{
157 Summary: data.Metrics,
158 Groups: board.ToJSON(data.GroupedTasks),
159 GroupBy: data.GroupBy,
160 CriticalPath: cpTasks,
161 BlockedTasks: blockedTasks,
162 }
163
164 if data.IncludeGraph {
165 rj.Graph = data.GraphJSON
166 }
167
168 return WriteJSON(outFile, rj)
169}

Callers 1

runReportFunction · 0.85

Calls 3

taskToReportJSONFunction · 0.85
WriteJSONFunction · 0.85
ToJSONMethod · 0.80

Tested by

no test coverage detected