Skip to content

Commit

Permalink
scheme: Dump sorted options
Browse files Browse the repository at this point in the history
  • Loading branch information
shramov committed Nov 17, 2023
1 parent 954a925 commit 01c9a4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/scheme.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1678,12 +1678,17 @@ std::string dump(const tll::scheme::Option * options, std::string_view key = "op
std::string r;
r += fmt::format("{}: {{", key);
bool comma = false;
std::map<std::string_view, std::string_view> map;
for (auto &o : list_wrap(options)) {
if (o.name == std::string_view("_auto")) continue;
map.emplace(o.name, o.value);
}

for (auto & [k, v] : map) {
if (comma)
r += ", ";
comma = true;
r += fmt::format("'{}': '{}'", o.name, o.value);
r += fmt::format("'{}': '{}'", k, v);
}
r += "}";
return r;
Expand Down

0 comments on commit 01c9a4e

Please sign in to comment.