Skip to content

Commit bdec179

Browse files
committed
style(build): compact diagnostic output
1 parent ed5dad6 commit bdec179

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

src/build/BuildStyle.cpp

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,21 @@ namespace vix::cli::build
114114
print_label(out, label);
115115
out << " " << value << "\n\n";
116116
}
117+
118+
static void print_compact_optional_line(
119+
std::ostream &out,
120+
const std::string &label,
121+
const std::string &value)
122+
{
123+
if (value.empty())
124+
return;
125+
126+
out << " "
127+
<< colorize(label_color(label).c_str(), label)
128+
<< " "
129+
<< value
130+
<< "\n";
131+
}
117132
} // namespace
118133

119134
void print_build_header_full(
@@ -378,23 +393,20 @@ namespace vix::cli::build
378393
<< ""
379394
<< title
380395
<< style::RESET
381-
<< "\n\n";
396+
<< "\n";
382397

383-
if (!diagnostic.message.empty())
384-
{
385-
print_label(out, "message:");
386-
out << " " << diagnostic.message << "\n\n";
387-
}
398+
print_compact_optional_line(out, "message:", diagnostic.message);
388399

389400
if (diagnostic.has_location())
390401
{
391-
print_label(out, "location:");
392-
out << " "
402+
out << " "
403+
<< colorize(label_color("location:").c_str(), "location:")
404+
<< " "
393405
<< format_build_location(diagnostic.location)
394-
<< "\n\n";
406+
<< "\n";
395407
}
396408

397-
print_optional_line(out, "error:", diagnostic.error);
409+
print_compact_optional_line(out, "error:", diagnostic.error);
398410

399411
if (diagnostic.has_code_frame())
400412
{
@@ -432,7 +444,7 @@ namespace vix::cli::build
432444
out << "\n";
433445
}
434446

435-
print_optional_line(out, "hint:", diagnostic.hint);
447+
print_compact_optional_line(out, "hint:", diagnostic.hint);
436448
}
437449

438450
std::string format_build_location(

0 commit comments

Comments
 (0)