]>
jfr.im git - yt-dlp.git/blob - devscripts/make_readme.py
3 # yt-dlp --help | make_readme.py
4 # This must be run in a console of correct width
6 from __future__
import unicode_literals
12 README_FILE
= 'README.md'
13 helptext
= sys
.stdin
.read()
15 if isinstance(helptext
, bytes):
16 helptext
= helptext
.decode('utf-8')
18 with io
.open(README_FILE
, encoding
='utf-8') as f
:
21 header
= oldreadme
[:oldreadme
.index('## General Options:')]
22 footer
= oldreadme
[oldreadme
.index('# CONFIGURATION'):]
24 options
= helptext
[helptext
.index(' General Options:'):]
25 options
= re
.sub(r
'(?m)^ (\w.+)$', r
'## \1', options
)
26 options
= options
+ '\n'
28 with io
.open(README_FILE
, 'w', encoding
='utf-8') as f
: