List deprecated option aliases in the docs

This commit is contained in:
Eelco Dolstra 2020-08-20 11:13:17 +02:00
parent acb99f03f9
commit 3c4f8c9175
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 8 additions and 2 deletions

View file

@ -1,11 +1,16 @@
. | to_entries | sort_by(.key) | map( . | to_entries | sort_by(.key) | map(
" - `" + .key + "` \n\n" " - `" + .key + "` \n\n"
+ (.value.description | split("\n") | map(" " + . + "\n") | join("")) + "\n\n" + (.value.description | split("\n") | map(" " + . + "\n") | join("")) + "\n\n"
+ " **Default**: " + ( + " **Default:** " + (
if .value.value == "" or .value.value == [] if .value.value == "" or .value.value == []
then "*empty*" then "*empty*"
elif (.value.value | type) == "array" elif (.value.value | type) == "array"
then "`" + (.value.value | join(" ")) + "`" then "`" + (.value.value | join(" ")) + "`"
else "`" + (.value.value | tostring) + "`" end) else "`" + (.value.value | tostring) + "`"
end)
+ "\n\n" + "\n\n"
+ (if (.value.aliases | length) > 0
then " **Deprecated alias:** " + (.value.aliases | map("`" + . + "`") | join(", ")) + "\n\n"
else ""
end)
) | join("") ) | join("")

View file

@ -139,6 +139,7 @@ nlohmann::json Config::toJSON()
if (!s.second.isAlias) { if (!s.second.isAlias) {
auto obj = nlohmann::json::object(); auto obj = nlohmann::json::object();
obj.emplace("description", s.second.setting->description); obj.emplace("description", s.second.setting->description);
obj.emplace("aliases", s.second.setting->aliases);
obj.emplace("value", s.second.setting->toJSON()); obj.emplace("value", s.second.setting->toJSON());
res.emplace(s.first, obj); res.emplace(s.first, obj);
} }