Skip to content

Commit 161fff3

Browse files
committed
add input checks
- Handle empty `filepaths` - If both are not given, raise an error
1 parent 5de9d0b commit 161fff3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

dvuploader/cli.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def _validate_inputs(
9090

9191
@app.command()
9292
def main(
93-
filepaths: List[str] = typer.Argument(
93+
filepaths: Optional[List[str]] = typer.Argument(
9494
default=None,
9595
help="A list of filepaths to upload.",
9696
),
@@ -141,6 +141,15 @@ def main(
141141
Upload files via config file:
142142
$ dvuploader --config-path upload_config.yaml
143143
"""
144+
145+
if not filepaths and not config_path:
146+
raise typer.BadParameter(
147+
"You must provide either a list of filepaths or a path to a configuration file via the --config-path option."
148+
)
149+
150+
if filepaths is None:
151+
filepaths = []
152+
144153
_validate_inputs(
145154
filepaths=filepaths,
146155
pid=pid,

0 commit comments

Comments
 (0)