Skip to content

Commit 3d77827

Browse files
committed
refactor format 2
1 parent af16dec commit 3d77827

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gendiff/formater/to_plain.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def convert(elem):
2020
return '[complex value]'
2121

2222

23-
def format(diffs, path=""):
23+
def get_plain(diffs, path=""):
2424
lines = []
2525
for item in diffs:
2626
head = f"{path}{item['name']}"
@@ -34,6 +34,10 @@ def format(diffs, path=""):
3434
tail = f". From {(value[0])} to {value[1]}"
3535
lines.append(f"{level}{item['meta']}{tail}")
3636
if is_nest(item) and item['meta'] == 'unchanged':
37-
value = format(item['children'], f"{head}.")
37+
value = get_plain(item['children'], f"{head}.")
3838
lines.append(f"{value}")
3939
return '\n'.join(lines)
40+
41+
42+
def format(diff):
43+
return get_plain(diff)

0 commit comments

Comments
 (0)