diff --git a/app/src/main/java/io/seqera/wave/cli/App.java b/app/src/main/java/io/seqera/wave/cli/App.java index 0ff7192..5a4772b 100644 --- a/app/src/main/java/io/seqera/wave/cli/App.java +++ b/app/src/main/java/io/seqera/wave/cli/App.java @@ -348,6 +348,9 @@ protected void validateArgs() { if( singularity && !freeze ) throw new IllegalCliArgumentException("Singularity build requires enabling freeze mode"); + if( inspect && isEmpty(image) ) + throw new IllegalCliArgumentException("Option --inspect requires the use of container image (--image)"); + if( !isEmpty(contextDir) ) { // check that a container file has been provided if( isEmpty(containerFile) ) diff --git a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy index 83e31d8..8786e59 100644 --- a/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy +++ b/app/src/test/groovy/io/seqera/wave/cli/AppTest.groovy @@ -585,4 +585,20 @@ class AppTest extends Specification { '2.0.0' | '2.1.0' | '2.0.0 (required: 2.1.0)' } + def 'should fail when inspecting without container image' () { + given: + def app = new App() + String[] args = ["--conda-package", "bwa", "--freeze", "--singularity", "--inspect"] + + when: + def cli = new CommandLine(app) + cli.parseArgs(args) + and: + app.validateArgs() + then: + def e = thrown(IllegalCliArgumentException) + and: + e.getMessage() == "Option --inspect requires the use of container image (--image)" + } + }