1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-24 19:29:36 +01:00

Move writeStructuredAttrsShell out of ParsedDerivation class

This commit is contained in:
Maximilian Bosch 2021-06-22 20:37:25 +02:00
parent 27ce722638
commit 6f206549ba
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
5 changed files with 13 additions and 9 deletions

View file

@ -165,13 +165,13 @@ std::optional<nlohmann::json> ParsedDerivation::prepareStructuredAttrs(std::opti
return json;
}
std::string ParsedDerivation::writeStructuredAttrsShell(nlohmann::json & json)
/* As a convenience to bash scripts, write a shell file that
maps all attributes that are representable in bash -
namely, strings, integers, nulls, Booleans, and arrays and
objects consisting entirely of those values. (So nested
arrays or objects are not supported.) */
std::string writeStructuredAttrsShell(nlohmann::json & json)
{
/* As a convenience to bash scripts, write a shell file that
maps all attributes that are representable in bash -
namely, strings, integers, nulls, Booleans, and arrays and
objects consisting entirely of those values. (So nested
arrays or objects are not supported.) */
auto handleSimpleType = [](const nlohmann::json & value) -> std::optional<std::string> {
if (value.is_string())