docs: def main():
      '''
      Set up "optparse" and pass the options to
      a new instance of L{LatexMaker}.
      '''
      prog = 'latexmk.py'
      version = __version__
      usage = '%prog [options] [filename]'
  
      # Read description from doc
      doc_text = ''
      for line in __doc__.splitlines():
          if line.find('#') == 0:
              break
          doc_text += '  %s\n' % line
  
      parser = OptionParser(prog=prog, usage=usage, version=version)
      parser.add_option('-c', '--clean',
                        action='store_true', dest='clean', default=False,
                        help='clean all temporary files after converting')
      parser.add_option('-q', '--quiet',
                        action='store_false', dest='verbose', default=True,
                        help='don\'t print status messages to stdout')
      parser.add_option('-n', '--no-exit',
                        action='store_false', dest='exit_on_error', default=True,
                        help='don\'t exit if error occurs')
      parser.add_option('-p', '--preview',
                        action='store_true', dest='preview', default=False,
                        help='try to open preview of generated document')
      parser.add_option('--dvi', action='store_false', dest='pdf',
                        default=True, help='use "latex" instead of pdflatex')
      parser.add_option('--check-cite', action='store_true', dest='check_cite',
                        default=False,
                        help='check bibtex file for uncited entries')
  
      opt, args = parser.parse_args()
      if len(args) == 0:
          tex_files = fnmatch.filter(os.listdir(os.getcwd()), '*.tex')
          if len(tex_files) == 1:
              name = tex_files[0]
          else:
              parser.error('could not find a single *.tex file in current dir')
      elif len(args) == 1:
          name = args[0]
      else:
          parser.error('incorrect number of arguments')
  
      LatexMaker(name, opt).run()