Skip to content

Commit c6572fc

Browse files
committed
helpers: simplify flat output format
Always print values as strings instead of Python literals. This massively simplifies the parsing in scripts. Only newlines are escaped with backslash continuations. It now mostly resembles INI files that are parsed by many other tools and libraries.
1 parent 83bd2f6 commit c6572fc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pym/bob/cmds/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def dumpFlat(doc, prefix=""):
3333
ret.extend(dumpFlat(v, "{}[{}]".format(prefix, i)))
3434
i += 1
3535
else:
36-
ret = [ "{}={!r}".format(prefix, doc) ]
36+
doc = str(doc).replace('\n', '\\n')
37+
ret = [ "{}={}".format(prefix, doc) ]
3738

3839
return ret

0 commit comments

Comments
 (0)