|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
|
from functools import reduce
|
|
|
|
|
|
|
|
|
|
PREFIX = '''# python-gjk
|
|
|
|
|
|
|
|
|
@ -23,8 +24,29 @@ def get_mds(path):
|
|
|
|
|
|
|
|
|
|
def mkformat(files):
|
|
|
|
|
result = []
|
|
|
|
|
files = [list(os.path.split(i)) for i in files]
|
|
|
|
|
files = path_dict(files)
|
|
|
|
|
|
|
|
|
|
for key in files:
|
|
|
|
|
result.append(f'## {key}')
|
|
|
|
|
for name in sorted(files[key]):
|
|
|
|
|
result.append(f'+ [{name}]({os.path.join(key, name)})')
|
|
|
|
|
result.append('')
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def path_dict(files):
|
|
|
|
|
di = dict()
|
|
|
|
|
for x, y in files:
|
|
|
|
|
if not di.get(x):
|
|
|
|
|
di[x] = []
|
|
|
|
|
di[x].append(y)
|
|
|
|
|
return di
|
|
|
|
|
|
|
|
|
|
files = sorted([i[2:] for i in get_mds('.') if i != './README'])
|
|
|
|
|
|
|
|
|
|
files = [i for i in get_mds('.') if i != './README']
|
|
|
|
|
with open('README.md', 'w') as f:
|
|
|
|
|
f.writelines(PREFIX + mkformat(files))
|
|
|
|
|
to_write = PREFIX + mkformat(files)
|
|
|
|
|
to_write = [i + '\n' for i in to_write]
|
|
|
|
|
f.writelines(to_write)
|
|
|
|
|