Update import_drops command to accept multiple JSON file paths
This commit is contained in:
parent
7d81b1a1b5
commit
97df0b342b
1 changed files with 19 additions and 16 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue