mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Add formatting switches for different use cases
This commit is contained in:
parent
a93cd158fa
commit
41a4fb9055
1 changed files with 12 additions and 6 deletions
|
@ -1,8 +1,8 @@
|
||||||
def tostring(i, *, order=None):
|
def tostring(i, *, order=None, newline=False):
|
||||||
o = ''
|
o = ''
|
||||||
if i:
|
if i:
|
||||||
for v in i:
|
for v in i:
|
||||||
o += v + ' '
|
o += v + (' ' if newline is False else '\n')
|
||||||
o = o[:-1]
|
o = o[:-1]
|
||||||
elif order:
|
elif order:
|
||||||
o += order
|
o += order
|
||||||
|
@ -20,11 +20,17 @@ def tostring_commas(i):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def dict_tostring(i):
|
def dict_tostring(i, f=True):
|
||||||
o = ''
|
o = ''
|
||||||
if i:
|
|
||||||
for k, v in i.items():
|
if f:
|
||||||
o += '**' + k + ':** `' + tostring(v) + '`\n'
|
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
|
return o
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue