]> Raphaƫl G. Git Repositories - youtubedl/blob - devscripts/make_readme.py
Update changelog.
[youtubedl] / devscripts / make_readme.py
1 import sys
2 import re
3
4 README_FILE = 'README.md'
5 helptext = sys.stdin.read()
6
7 with open(README_FILE) as f:
8 oldreadme = f.read()
9
10 header = oldreadme[:oldreadme.index('# OPTIONS')]
11 footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
12
13 options = helptext[helptext.index(' General Options:')+19:]
14 options = re.sub(r'^ (\w.+)$', r'## \1', options, flags=re.M)
15 options = '# OPTIONS\n' + options + '\n'
16
17 with open(README_FILE, 'w') as f:
18 f.write(header)
19 f.write(options)
20 f.write(footer)