docs: def main(argv=None):
      """Command line app main function.
  
      :param list | None argv: Overrides command options (for libuse or testing)
      """
  
      parser = create_parser()
      args = parser.parse_args() if argv is None else parser.parse_args(argv)
  
      if not os.path.exists(args.path):
          sys.exit(0)
  
      all_valid = True
      single = os.path.isfile(args.path)
      files = [args.path] if single else iter_files(
          args.path, exts=('epub', ), recursive=args.recursive
      )
  
      pool = ThreadPool()
      results = pool.imap_unordered(EpubCheck, files)
  
      metas = tablib.Dataset(headers=Checker._fields + Meta._fields)
      messages = tablib.Dataset(headers=Message._fields)
  
      for result in results:
          metas.append(result.checker + result.meta.flatten())
          if not result.valid:
              all_valid = False
          for message in result.messages:
              messages.append(message)
              if message.level == 'ERROR':
                  print(message.short, file=sys.stderr)
              else:
                  print(message.short)
  
      if args.csv:
          args.csv.write(messages.export('csv', delimiter=b';'))
  
      if args.xls:
          databook = tablib.Databook((metas, messages))
          args.xls.write(databook.xls)
  
      if all_valid:
          return 0
      else:
          return 1