mirror of
https://github.com/NixOS/nix
synced 2025-06-28 13:41:15 +02:00
Allow 'nix' subcommands to provide docs in Markdown format
This commit is contained in:
parent
3c4f8c9175
commit
dc2f278c95
8 changed files with 68 additions and 40 deletions
|
@ -359,12 +359,14 @@ nlohmann::json Command::toJSON()
|
|||
for (auto & example : examples()) {
|
||||
auto ex = nlohmann::json::object();
|
||||
ex["description"] = example.description;
|
||||
ex["command"] = example.command;
|
||||
ex["command"] = chomp(stripIndentation(example.command));
|
||||
exs.push_back(std::move(ex));
|
||||
}
|
||||
|
||||
auto res = Args::toJSON();
|
||||
res["examples"] = std::move(exs);
|
||||
auto s = doc();
|
||||
if (s != "") res.emplace("doc", stripIndentation(s));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue