1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 13:41:15 +02:00

Group subcommands by category

This commit is contained in:
Eelco Dolstra 2021-01-25 18:19:32 +01:00
parent 3ba98ba8f0
commit 807d963ee8
3 changed files with 32 additions and 6 deletions

View file

@ -341,7 +341,10 @@ nlohmann::json MultiCommand::toJSON()
for (auto & [name, commandFun] : commands) {
auto command = commandFun();
auto j = command->toJSON();
j["category"] = categories[command->category()];
auto cat = nlohmann::json::object();
cat["id"] = command->category();
cat["description"] = categories[command->category()];
j["category"] = std::move(cat);
cmds[name] = std::move(j);
}