5 README_FILE = 'README.md'
6 helptext = sys.stdin.read()
8 if isinstance(helptext, bytes):
9 helptext = helptext.decode('utf-8')
11 with io.open(README_FILE, encoding='utf-8') as f:
14 header = oldreadme[:oldreadme.index('# OPTIONS')]
15 footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
17 options = helptext[helptext.index(' General Options:') + 19:]
18 options = re.sub(r'^ (\w.+)$', r'## \1', options, flags=re.M)
19 options = '# OPTIONS\n' + options + '\n'
21 with io.open(README_FILE, 'w', encoding='utf-8') as f: