1 from __future__ import unicode_literals
7 README_FILE = 'README.md'
8 helptext = sys.stdin.read()
10 if isinstance(helptext, bytes):
11 helptext = helptext.decode('utf-8')
13 with io.open(README_FILE, encoding='utf-8') as f:
16 header = oldreadme[:oldreadme.index('# OPTIONS')]
17 footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
19 options = helptext[helptext.index(' General Options:') + 19:]
20 options = re.sub(r'(?m)^ (\w.+)$', r'## \1', options)
21 options = '# OPTIONS\n' + options + '\n'
23 with io.open(README_FILE, 'w', encoding='utf-8') as f: