docs: def main():
      """Command-line entry point for running the view server."""
      import getopt
      from . import __version__ as VERSION
  
      try:
          option_list, argument_list = getopt.gnu_getopt(
              sys.argv[1:], 'h',
              ['version', 'help', 'json-module=', 'debug', 'log-file='])
  
          message = None
          for option, value in option_list:
              if option in ('--version'):
                  message = _VERSION % dict(name=os.path.basename(sys.argv[0]),
                                        version=VERSION)
              elif option in ('-h', '--help'):
                  message = _HELP % dict(name=os.path.basename(sys.argv[0]))
              elif option in ('--json-module'):
                  json.use(module=value)
              elif option in ('--debug'):
                  log.setLevel(logging.DEBUG)
              elif option in ('--log-file'):
                  if value == '-':
                      handler = logging.StreamHandler(sys.stderr)
                      handler.setFormatter(logging.Formatter(
                          ' -> [%(levelname)s] %(message)s'))
                  else:
                      handler = logging.FileHandler(value)
                      handler.setFormatter(logging.Formatter(
                          '[%(asctime)s] [%(levelname)s] %(message)s'))
                  log.addHandler(handler)
          if message:
              sys.stdout.write(message)
              sys.stdout.flush()
              sys.exit(0)
  
      except getopt.GetoptError, error:
          message = '%s\n\nTry `%s --help` for more information.\n' % (
              str(error), os.path.basename(sys.argv[0]))
          sys.stderr.write(message)
          sys.stderr.flush()
          sys.exit(1)
  
      sys.exit(run())