nextflow-io / nextflow

A DSL for data-driven computational pipelines
http://nextflow.io
Apache License 2.0
2.61k stars 605 forks source link

Plugin did not take subcommand options #5084

Open sfc-gh-hyu opened 1 week ago

sfc-gh-hyu commented 1 week ago

I am trying to develop a plugin against nextflow, however, it seems that subcommand options is considered as a parent command options:

Here is a simple plugin:

class MyPlugin extends BasePlugin implements PluginAbstractExec{

    MyPlugin(PluginWrapper wrapper) {
        super(wrapper)
    }

    @Override
    List<String> getCommands() {
        [ 'run' ]
    }

    @Override
    int exec(String cmd, List<String> args) {
        System.out.println("command array: " + Arrays.toString(args))
        if( cmd == 'run' ) {
            return 0
        }
        else {
            System.err.println "Invalid command: ${cmd}"
            return 1
        }
    }
}

When I run the plugin

$ ./launch.sh plugin nf-foo:run
command array: [[]]
$ ./launch.sh plugin nf-foo:run --foo bar
Unknown option: --foo=bar -- Check the available commands and options and syntax with 'help'

Did I miss anything?