From 161fff3bcf44c489c08ec508f93e176ea722dd85 Mon Sep 17 00:00:00 2001 From: Jan Range <30547301+JR-1991@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:38:09 +0100 Subject: [PATCH 1/3] add input checks - Handle empty `filepaths` - If both are not given, raise an error --- dvuploader/cli.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dvuploader/cli.py b/dvuploader/cli.py index ca74bd1..ed9427f 100644 --- a/dvuploader/cli.py +++ b/dvuploader/cli.py @@ -90,7 +90,7 @@ def _validate_inputs( @app.command() def main( - filepaths: List[str] = typer.Argument( + filepaths: Optional[List[str]] = typer.Argument( default=None, help="A list of filepaths to upload.", ), @@ -141,6 +141,15 @@ def main( Upload files via config file: $ dvuploader --config-path upload_config.yaml """ + + if not filepaths and not config_path: + raise typer.BadParameter( + "You must provide either a list of filepaths or a path to a configuration file via the --config-path option." + ) + + if filepaths is None: + filepaths = [] + _validate_inputs( filepaths=filepaths, pid=pid, From 1418653c9696da3f19c51a40a570f110f3a313b1 Mon Sep 17 00:00:00 2001 From: Jan Range <30547301+JR-1991@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:42:16 +0100 Subject: [PATCH 2/3] remove additional check --- dvuploader/cli.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dvuploader/cli.py b/dvuploader/cli.py index ed9427f..4897a8e 100644 --- a/dvuploader/cli.py +++ b/dvuploader/cli.py @@ -142,11 +142,6 @@ def main( $ dvuploader --config-path upload_config.yaml """ - if not filepaths and not config_path: - raise typer.BadParameter( - "You must provide either a list of filepaths or a path to a configuration file via the --config-path option." - ) - if filepaths is None: filepaths = [] From 1d577de5b04625be06f63a4b2b10035bdb1a4bb7 Mon Sep 17 00:00:00 2001 From: Jan Range <30547301+JR-1991@users.noreply.github.com> Date: Wed, 26 Feb 2025 21:42:46 +0100 Subject: [PATCH 3/3] run tests on pull request --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4b0229..8f96bad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: Integration Tests -on: [push] +on: [push, pull_request] jobs: build: