Skip to content

Commit

Permalink
allows parameters when run a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jagedn committed Jan 6, 2025
1 parent cc0163a commit 3910c72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/nextflow/src/main/groovy/nextflow/cli/CmdPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package nextflow.cli

import com.beust.jcommander.DynamicParameter
import com.beust.jcommander.Parameter
import com.beust.jcommander.Parameters
import groovy.transform.CompileStatic
Expand All @@ -38,6 +39,9 @@ class CmdPlugin extends CmdBase {
return 'plugin'
}

@DynamicParameter(names = "--", description = "Custom plugin parameters go here", hidden = true)
private Map<String, String> params = new HashMap<>();

@Parameter(hidden = true)
List<String> args

Expand Down Expand Up @@ -69,6 +73,12 @@ class CmdPlugin extends CmdBase {
throw new AbortOperationException("Cannot find target plugin: $target")
final plugin = wrapper.getPlugin()
if( plugin instanceof PluginExecAware ) {
def mapped = [] as List<String>
params.entrySet().each{
mapped << "--$it.key".toString()
mapped << "$it.value".toString()
}
args.addAll(mapped)
final ret = plugin.exec(getLauncher(), target, cmd, args)
// use explicit exit to invoke the system shutdown hooks
System.exit(ret)
Expand Down

0 comments on commit 3910c72

Please sign in to comment.