Report json fixes (#181)

* Move "No paths found." reporting

* delete ends

* Smallfix
This commit is contained in:
Akash Levy 2025-01-16 15:32:53 -08:00 committed by GitHub
parent 068183a49f
commit aaa9d2d377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View File

@ -335,7 +335,7 @@ void
ReportPath::reportPathEnds(PathEndSeq *ends)
{
reportPathEndHeader();
if (ends) {
if (ends && !ends->empty()) {
PathEndSeq::Iterator end_iter(ends);
PathEnd *prev_end = nullptr;
while (end_iter.hasNext()) {
@ -344,6 +344,10 @@ ReportPath::reportPathEnds(PathEndSeq *ends)
prev_end = end;
}
}
else {
if (format_ != ReportPathFormat::json)
report_->reportLine("No paths found.");
}
reportPathEndFooter();
}

View File

@ -512,13 +512,8 @@ report_path_cmd(PathRef *path)
void
report_path_ends(PathEndSeq *ends)
{
Sta *sta = Sta::sta();
Report *report = sta->report();
ReportPathFormat path_format = sta->reportPath()->pathFormat();
if (path_format == ReportPathFormat::json || (ends && ends->size() > 0))
sta->reportPathEnds(ends);
else
report->reportLine("No paths found.");
Sta::sta()->reportPathEnds(ends);
delete ends;
}
////////////////////////////////////////////////////////////////