]>
Commit | Line | Data |
---|---|---|
1 | import sys | |
2 | import re | |
3 | ||
4 | helptext = sys.stdin.read() | |
5 | ||
6 | f = open('README.md') | |
7 | oldreadme = f.read() | |
8 | f.close() | |
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 | f = open('README.md', 'w') | |
18 | f.write(header) | |
19 | f.write(options) | |
20 | f.write(footer) | |
21 | f.close() |