diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-08-20 12:21:46 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-08-20 12:21:46 +0200 |
commit | dc2f278c95ce4a73749cbb8221a568201535d46a (patch) | |
tree | 9e4a754396d63b731ed7e5ccfb7e572547d06e1a /src/libutil/args.cc | |
parent | 3c4f8c91759ac5ed6a211f8e72b9d4e8438db833 (diff) |
Allow 'nix' subcommands to provide docs in Markdown format
Diffstat (limited to 'src/libutil/args.cc')
-rw-r--r-- | src/libutil/args.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc index ad83a2414..147602415 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -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; } |