-
Notifications
You must be signed in to change notification settings - Fork 635
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
CLI v2 #3600
base: master
Are you sure you want to change the base?
CLI v2 #3600
Conversation
Signed-off-by: Ben Sherman <[email protected]>
I'd propose keeping the current CLI in the current package. That would make the PR much simpler |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
@pditommaso Today I realized that picocli can't really tell the difference between pipeline args and pipeline params in the nextflow run script.nf arg1 arg2 --param1 value1 --param2=value2 Whereas jcommander can use So there are two solutions:
I'm assuming you don't want to do (1), so let's explore (2) for a moment. In the above example, picocli would parse the positional args as: args = ['arg1', 'arg2', '--param1', 'value1', '--param2=value2'] Then Nextflow would separate the args from params as follows: scriptArgs = ['arg1', 'arg2']
args = ['param1': 'value1', 'param2': 'value2'] Since the CLI has no idea what args or params are expected by the pipeline script at this point, I think this is the best we can do. Basically it means that you can't provide an arg value that looks like an option. |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
b5eb83b
to
49c49a8
Compare
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Great job Ben ! 🧨💥🚀 |
Good catch. We should also think about the unit tests and integration tests. All of the integration tests use the current CLI, so it would be good to have a single e2e test for the CLI v2 that simply runs a bunch of different commands (see #3600 (comment)) |
This is a bit risky - note that the ANSI codes will be dumped to redirected text files / anything that can't support ANSI output. The ANSI logger is smarter than that and strips the codes if the output doesn't support them. |
Couple of thoughts from looking at the help output:
|
@pditommaso , we would be keen on your feedback on this PR, firstly from a feature-set perspective, and optionally from the tech standpoint. Thank you! |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Okay, I just removed the ANSI logging from this part
Good catch
Since
Looks non trivial as the help text is customized in an annotation. It's probably possible but I'm not going to bother with it. You're welcome to try 😄 |
@bentsherman can you check the merge conflicts from master? |
For the new CLI I think we should consider removing support for args in the run command. You can specify args and access them in the pipeline script via |
Good point Ben. I personally did NOT know of the feature. I see it is not documented in docs.nextflow.io, and that it is not used across nf-core (see e.g. this search https://github.com/search?q=org%3Anf-core+path%3A*.nf+args%5B0+&type=code). I agree it clashes with our discourse on more formal input schemas. I am in favour of dropping it. |
I've heard of some folks using it, eg. @FelixKrueger / @s-andrews at Babraham. We've actually just made use of it for the first time in @nf-core a few days ago, purely as a method to autodetect malformed Agree that we should remove it, as the majority of the time it's just a way for stuff to fail silently. Having a hard failure would be better. The main valid use is to be able to glob input files. But yeah, I think very few do that and there are probably better ways to handle it (eg. if / when we build tooling to automate the generation of sample sheets for local files). |
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
Signed-off-by: Ben Sherman <[email protected]>
From our conversation about this PR last week -- if we remove run args from CLI v1, that would allow us to migrate CLI v1 from jcommander to picocli, with the benefits of better My understanding was that if we do release CLI v2 then we would eventually deprecate the old CLI, so the extra scaffolding to maintain both would be temporary. |
Moving this to draft. I am now also wary about introducing this change amidst everything else that we are doing. I would prefer to refactor the existing CLI to picocli to fix the various issues with option parsing, and maybe also the improvements to CLI params described in #4669 , to make sure that we address the main CLI issues that users deal with. After that, if there is still lots of interest in having a proper GNU command line, maybe we can do it more cleanly at that point. |
Closes #3595
To summarize:
nextflow.cli.*Impl
classes implement the core functionality of each commandnextflow.cli.v1.*Cmd
classes implement the CLI v1 and pass options to corresponding*Impl
classnextflow.cli.v2.*Cmd
classes implement the CLI v2 and pass options to corresponding*Impl
classnextflow.cli.v1.Launcher
andnextflow.cli.v2.Launcher
provide entrypoints to the v1 and v2 CLI respectivelyTODO:
Test support for list values(keep same as CLI v1)Test support for basic type conversion(keep same as CLI v1)