chore: Add option to render markdown summary report from query command

This commit is contained in:
abhisek 2024-03-26 18:53:45 +05:30
parent bfa63005e6
commit b6b0381ef2
No known key found for this signature in database
GPG Key ID: CB92A4990C02A88F

View File

@ -21,6 +21,7 @@ var (
querySummaryReportMaxAdvice int
querySummaryReportGroupByDirectDeps bool
queryMarkdownReportPath string
queryMarkdownSummaryReportPath string
queryJsonReportPath string
queryGraphReportPath string
queryCsvReportPath string
@ -66,6 +67,8 @@ func newQueryCommand() *cobra.Command {
"Group summary by direct dependencies")
cmd.Flags().StringVarP(&queryMarkdownReportPath, "report-markdown", "", "",
"Generate markdown report to file")
cmd.Flags().StringVarP(&queryMarkdownSummaryReportPath, "report-markdown-summary", "", "",
"Generate markdown summary report to file")
cmd.Flags().StringVarP(&queryJsonReportPath, "report-json", "", "",
"Generate JSON report to file (EXPERIMENTAL)")
cmd.Flags().StringVarP(&queryGraphReportPath, "report-graph", "", "",
@ -160,6 +163,18 @@ func internalStartQuery() error {
reporters = append(reporters, rp)
}
if !utils.IsEmptyString(queryMarkdownSummaryReportPath) {
rp, err := reporter.NewMarkdownSummaryReporter(reporter.MarkdownSummaryReporterConfig{
Path: queryMarkdownSummaryReportPath,
})
if err != nil {
return err
}
reporters = append(reporters, rp)
}
if !utils.IsEmptyString(queryJsonReportPath) {
rp, err := reporter.NewJsonReportGenerator(reporter.JsonReportingConfig{
Path: queryJsonReportPath,