In a plugin, access to the parsed arguments from the command line

This is more of a JVM question.

From a plugin, in what way can I drill back to Launcher.normalizedArgs?

Sure, I can parse session.commandLine, but I’m interested in a more ‘elegant’ solution.

You can use session.params if you just want the pipeline params, otherwise you’ll have to re-parse session.commandLine.

What exactly are you looking for?

Specifically, the value of -params-file, if set.
From an audit point of view, the whole of params is, of course, very important. In this case, our users control the pipeline only through a large params file, not config files or individual params on the command line. So, they want to have just what they see as the difference between runs published. I’m extending your example from Episode 35 to copy any random file to publishdir.

You could take session.params and write it to a JSON or YAML file in the output directory. In fact, I think the nf-core pipeline template does this. There is a function called dumpParametersToJSON