Skip to content

Commit 8076cfb

Browse files
committed
feat(upload): add subdirectory option to upload.py
1 parent 49e8809 commit 8076cfb

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

upload.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# ]
77
# ///
88

9+
import argparse
910
import asyncio
1011
import os
1112
from pathlib import Path
@@ -19,11 +20,14 @@
1920
MAX_CONCURRENT = 100
2021

2122

22-
def get_files():
23+
def get_files(subdir: str | None = None):
24+
base_path = Path("site/benchmarks")
25+
search_path = base_path / subdir if subdir else base_path
26+
2327
files = []
24-
for f in Path("site/benchmarks").rglob("*"):
28+
for f in search_path.rglob("*"):
2529
if f.is_file() and not f.name.startswith("."):
26-
rel_path = str(f.relative_to("site/benchmarks")).replace("\\", "/")
30+
rel_path = str(f.relative_to(base_path)).replace("\\", "/")
2731
files.append((f, rel_path))
2832
return files
2933

@@ -41,7 +45,14 @@ async def upload_file(client, sem, local_path, remote_path):
4145

4246

4347
async def main():
44-
files = get_files()
48+
parser = argparse.ArgumentParser(description="Upload benchmark files to Bunny CDN")
49+
parser.add_argument(
50+
"--subdir",
51+
help="Subdirectory within site/benchmarks/ to upload (e.g., 'strategies')",
52+
)
53+
args = parser.parse_args()
54+
55+
files = get_files(args.subdir)
4556

4657
if not files:
4758
print("No files to upload")

0 commit comments

Comments
 (0)