docs: def cmd_export_all(*args):
      """
      Arguments:
          <output folder> [-- [--quality <0-100>] [--page_format <page_format>]]
  
      Export all documents as PDF files.
  
      Default quality is 50.
      Default page format is A4.
  
      Possible JSON replies:
          --
          {
              "status": "error", "exception": "yyy",
              "reason": "xxxx", "args": "(xxxx, )"
          }
          --
          {
              "status": "ok",
              "docids": [
                          ["xxx", "file:///tmp/xxx.pdf"],
                          ["yyy", "file:///tmp/yyy.pdf"],
                          ["zzz", "file:///tmp/zzz.pdf"]
                        ],
              "output_dir": "file:///tmp",
          }
      """
      (output_dir, quality, page_format) = _get_export_params(args)
  
      dsearch = get_docsearch()
  
      try:
          os.mkdir(output_dir)
      except FileExistsError:  # NOQA (Python 3.x only)
          pass
  
      out = []
  
      docs = [d for d in dsearch.docs]
      docs.sort(key=lambda doc: doc.docid)
      output_dir = FS.safe(output_dir)
      for (doc_idx, doc) in enumerate(docs):
          output_pdf = FS.join(output_dir, doc.docid + ".pdf")
  
          exporter = doc.build_exporter(file_format="pdf")
          if exporter.can_change_quality:
              exporter.set_quality(quality)
          if exporter.can_select_format:
              exporter.set_page_format(page_format)
          verbose(
              "[{}/{}] Exporting {} --> {} ...".format(
                  doc_idx + 1, len(docs), doc.docid, output_pdf
              )
          )
          exporter.save(output_pdf)
          out.append((doc.docid, output_pdf))
          doc = None
          gc.collect()
  
      verbose("Done")
      reply({
          "docids": out,
          "output_dir": output_dir,
      })