1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 14:27:27 +00:00

Add formatting switches for different use cases

This commit is contained in:
Dylan Dizon 2018-11-06 15:22:02 -05:00
parent a93cd158fa
commit 41a4fb9055

View file

@ -1,8 +1,8 @@
def tostring(i, *, order=None):
def tostring(i, *, order=None, newline=False):
o = ''
if i:
for v in i:
o += v + ' '
o += v + (' ' if newline is False else '\n')
o = o[:-1]
elif order:
o += order
@ -20,11 +20,17 @@ def tostring_commas(i):
return ''
def dict_tostring(i):
def dict_tostring(i, f=True):
o = ''
if f:
if i:
for k, v in i.items():
o += '**' + k + ':** `' + tostring(v) + '`\n'
else:
if i:
for k, v in i.items():
o += k + ': ```' + tostring(v, newline=True) + '```\n'
return o