aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-01-25 18:19:32 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-01-25 18:19:32 +0100
commit807d963ee8d23e88f09e28365b045d322530c5aa (patch)
tree69a055b564097daa62b15a84aa3458b1c80df178 /src
parent3ba98ba8f08523e60310cf75ec809bd21d0ce977 (diff)
Group subcommands by category
Diffstat (limited to 'src')
-rw-r--r--src/libutil/args.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 2f2e4bb96..6d57e1a34 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -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);
}