You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
500 B

  1. import sys
  2. import re
  3. README_FILE = 'README.md'
  4. helptext = sys.stdin.read()
  5. with open(README_FILE) as f:
  6. oldreadme = f.read()
  7. header = oldreadme[:oldreadme.index('# OPTIONS')]
  8. footer = oldreadme[oldreadme.index('# CONFIGURATION'):]
  9. options = helptext[helptext.index(' General Options:')+19:]
  10. options = re.sub(r'^ (\w.+)$', r'## \1', options, flags=re.M)
  11. options = '# OPTIONS\n' + options + '\n'
  12. with open(README_FILE, 'w') as f:
  13. f.write(header)
  14. f.write(options)
  15. f.write(footer)