]> jfr.im git - yt-dlp.git/blame - devscripts/make_readme.py
Merge branch 'myvideo_ge' of https://github.com/fonkap/youtube-dl into fonkap-myvideo_ge
[yt-dlp.git] / devscripts / make_readme.py
CommitLineData
dcddc10a
PH
1from __future__ import unicode_literals
2
1e91866f 3import io
4bb028f4
FV
4import sys
5import re
6
682407f2 7README_FILE = 'README.md'
4bb028f4
FV
8helptext = sys.stdin.read()
9
49f2bf76
PH
10if isinstance(helptext, bytes):
11 helptext = helptext.decode('utf-8')
12
1e91866f 13with io.open(README_FILE, encoding='utf-8') as f:
682407f2 14 oldreadme = f.read()
4bb028f4
FV
15
16header = oldreadme[:oldreadme.index('# OPTIONS')]
139cb942 17# footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
4bb028f4 18
49f2bf76 19options = helptext[helptext.index(' General Options:') + 19:]
d19bb9c0 20options = re.sub(r'(?m)^ (\w.+)$', r'## \1', options)
4bb028f4
FV
21options = '# OPTIONS\n' + options + '\n'
22
1e91866f 23with io.open(README_FILE, 'w', encoding='utf-8') as f:
682407f2 24 f.write(header)
25 f.write(options)
139cb942 26 # f.write(footer)