3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-05-06 15:25:47 +00:00

log_help: Options can have content

Refactor `PrettyHelp::endgroup()` -> `PrettyHelp::close(int levels = 1)`.
This commit is contained in:
Krystine Sherwin 2025-03-21 10:25:45 +13:00
parent af9e0dd0f4
commit 40e6fe8263
No known key found for this signature in database
3 changed files with 27 additions and 15 deletions

View file

@ -84,13 +84,14 @@ void PrettyHelp::usage(const string &usage)
log("\n");
}
void PrettyHelp::option(const string &option, const string &description)
void PrettyHelp::option(const string &text, const string &description)
{
log_pass_str(option, current_indent);
open_option(text);
if (description.length()) {
log_pass_str(description, current_indent+1);
log_pass_str(description, current_indent);
log("\n");
}
close(1);
}
void PrettyHelp::codeblock(const string &code, const string &)
@ -104,13 +105,19 @@ void PrettyHelp::paragraph(const string &text)
log("\n");
}
void PrettyHelp::optiongroup(const string &)
void PrettyHelp::open_optiongroup(const string &)
{
current_indent += 1;
}
void PrettyHelp::endgroup()
void PrettyHelp::open_option(const string &text)
{
current_indent -= 1;
log_pass_str(text, current_indent);
current_indent += 1;
}
void PrettyHelp::close(int levels)
{
current_indent -= levels;
log_assert(current_indent >= 0);
}