# Generate an HTML help file for a bunch of Unix-style command line utilities. # You can do whatever you like with this code. # # Eli Golovinsky # November 2006 # www.gooli.org import os import os.path import cgi helpLines = [] contentsLines = [] for f in os.listdir('.'): if f.endswith('exe'): helpLines.append('

%s

\n' % (f,f)) contentsLines.append('
  • %s
  • \n' % (f,f)) help = os.popen('%s --help' % f).read() help = cgi.escape(help) helpLines.append('
    \n%s
    \n' % help) html = open('help.html', 'w') html.write("""\ """) html.write("

    Command Line Help

    ") html.write("

    Contents

    \n\n") html.write("".join(helpLines)) html.write("""\ """) html.close()