Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin did not take subcommand options #5084

Open
sfc-gh-hyu opened this issue Jun 20, 2024 · 3 comments · May be fixed by #5643
Open

Plugin did not take subcommand options #5084

sfc-gh-hyu opened this issue Jun 20, 2024 · 3 comments · May be fixed by #5643
Assignees
Labels

Comments

@sfc-gh-hyu
Copy link

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?

@sfc-gh-hyu
Copy link
Author

Ping on this. Is there any plan to fix this?

@bentsherman
Copy link
Member

@sfc-gh-hyu sorry for the delay, we will look into it when we have some time

@tom-seqera
Copy link
Contributor

@sfc-gh-hyu my understanding is that anything prefixed by - or -- will currently be treated by nextflow as an option for nextflow itself. You can pass arguments to the plugin command without prefixes, like so:

$ ./launch.sh plugin nf-foo:run bar
command array: [[bar]]

$ ./launch.sh plugin nf-foo:run foo bar
command array: [[foo, bar]]

@jagedn jagedn linked a pull request Jan 6, 2025 that will close this issue
@bentsherman bentsherman linked a pull request Jan 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants