Skip to content

Commit

Permalink
update stdlib (google#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime authored Nov 3, 2017
1 parent fd1eaa9 commit e72d930
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions std/std.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,18 @@ limitations under the License.
std.foldl(function(a, b) a + b, arrs, []),

manifestIni(ini)::
local body_lines(body) = ["%s = %s" % [k, body[k]] for k in std.objectFields(body)],
section_lines(sname, sbody) = ["[%s]" % [sname]] + body_lines(sbody),
local body_lines(body) =
std.join([], [
local value_or_values = body[k];
if std.type(value_or_values) == "array" then
["%s = %s" % [k, value] for value in value_or_values]
else
["%s = %s" % [k, value_or_values]]

for k in std.objectFields(body)
]);

local section_lines(sname, sbody) = ["[%s]" % [sname]] + body_lines(sbody),
main_body = if std.objectHas(ini, "main") then body_lines(ini.main) else [],
all_sections = [section_lines(k, ini.sections[k])
for k in std.objectFields(ini.sections)];
Expand Down

0 comments on commit e72d930

Please sign in to comment.