Update import_drops command to accept multiple JSON file paths

This commit is contained in:
Joakim Hellsén 2025-09-05 01:04:30 +02:00
commit 97df0b342b

View file

@ -58,7 +58,8 @@ class Command(BaseCommand):
parser: The command argument parser.
"""
parser.add_argument(
"path",
"paths",
nargs="+",
type=str,
help="Path to the JSON file or directory containing JSON files.",
)
@ -79,9 +80,11 @@ class Command(BaseCommand):
CommandError: If the file/directory doesn't exist, isn't a JSON file,
or has an invalid JSON structure.
"""
path: Path = Path(options["path"])
paths: list[str] = options["paths"]
processed_dir: str = options["processed_dir"]
for p in paths:
path: Path = Path(p)
processed_path: Path = path / processed_dir
processed_path.mkdir(exist_ok=True)