3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-23 14:11:28 +00:00

register.cc: Tidying

Use `yosys_maybe_version()` in `dump_cmds_json()`.
Replace `&it` with `&[name, pass]`.
Add a space when folding indented lines into usage signature.
This commit is contained in:
Krystine Sherwin 2025-11-17 18:51:01 +13:00
parent 4eff547f6f
commit f2a80e4d7f
No known key found for this signature in database

View file

@ -739,16 +739,14 @@ struct HelpPass : public Pass {
// init json // init json
json.begin_object(); json.begin_object();
json.entry("version", "Yosys command reference"); json.entry("version", "Yosys command reference");
json.entry("generator", yosys_version_str); json.entry("generator", yosys_maybe_version());
bool raise_error = false; bool raise_error = false;
std::map<string, vector<string>> groups; std::map<string, vector<string>> groups;
json.name("cmds"); json.begin_object(); json.name("cmds"); json.begin_object();
// iterate over commands // iterate over commands
for (auto &it : pass_register) { for (auto &[name, pass] : pass_register) {
auto name = it.first;
auto pass = it.second;
auto title = pass->short_help; auto title = pass->short_help;
auto cmd_help = PrettyHelp(); auto cmd_help = PrettyHelp();
@ -863,7 +861,7 @@ struct HelpPass : public Pass {
if (current_buffer.empty()) if (current_buffer.empty())
current_buffer = stripped_line; current_buffer = stripped_line;
else if (current_state == PUState_signature && IsIndent) else if (current_state == PUState_signature && IsIndent)
current_buffer += stripped_line; current_buffer += " " + stripped_line;
else if (current_state == PUState_none) { else if (current_state == PUState_none) {
current_buffer += (blank_lines > 0 ? "\n\n" : "\n") + line; current_buffer += (blank_lines > 0 ? "\n\n" : "\n") + line;
} else } else