"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
bin/make_backend_docs: allow generation of docs for just one backend
buengese621c4ebe1560
diff --git a/bin/make_backend_docs.py b/bin/make_backend_docs.pyindex 8753061f9..1871cc68b 100755--- a/bin/make_backend_docs.py+++ b/bin/make_backend_docs.py@@ -3,9 +3,11 @@Make backend documentation"""+import sysimport osimport ioimport subprocess+from pathlib import Pathmarker = "{{< rem autogenerated options"start = marker + " start"@@ -16,18 +18,19 @@ def find_backends():"""Return a list of all backends"""return [ x for x in os.listdir("backend") if x not in ("all",) ]-def output_docs(backend, out):+def output_docs(backend, out, cwd):"""Output documentation for backend options to out"""out.flush()- subprocess.check_call(["rclone", "help", "backend", backend], stdout=out)+ subprocess.check_call(["./rclone", "help", "backend", backend], stdout=out)-def output_backend_tool_docs(backend, out):+def output_backend_tool_docs(backend, out, cwd):"""Output documentation for backend tool to out"""out.flush()- subprocess.call(["rclone", "backend", "help", backend], stdout=out, stderr=subprocess.DEVNULL)+ subprocess.call(["./rclone", "backend", "help", backend], stdout=out, stderr=subprocess.DEVNULL)def alter_doc(backend):"""Alter the documentation for backend"""+ rclone_bin_dir = Path(sys.path[0]).parent.absolute()doc_file = "docs/content/"+backend+".md"if not os.path.exists(doc_file):raise ValueError("Didn't find doc file %s" % (doc_file,))@@ -41,8 +44,8 @@ def alter_doc(backend):in_docs = Truestart_full = (start + "\" - DO NOT EDIT - instead edit fs.RegInfo in backend/%s/%s.go then run make backenddocs\" " + end + "\n") % (backend, backend)out_file.write(start_full)- output_docs(backend, out_file)- output_backend_tool_docs(backend, out_file)+ output_docs(backend, out_file, rclone_bin_dir)+ output_backend_tool_docs(backend, out_file, rclone_bin_dir)out_file.write(stop+" "+end+"\n")altered = Trueif not in_docs:@@ -55,7 +58,18 @@ def alter_doc(backend):if not altered:raise ValueError("Didn't find '%s' markers for in %s" % (start, doc_file))-if __name__ == "__main__":++def main(args):+ # single backend+ if (len(args) == 2):+ try:+ alter_doc(args[1])+ print("Added docs for %s backend" % args[1])+ except Exception as e:+ print("Failed adding docs for %s backend: %s" % (args[1], e))+ return++ # all backendsfailed, success = 0, 0for backend in find_backends():try:@@ -66,3 +80,6 @@ if __name__ == "__main__":else:success += 1print("Added docs for %d backends with %d failures" % (success, failed))++if __name__ == "__main__":+ main(sys.argv)