When submitting a params starting with - or -- with quotes, Nextflow thinks it's a Nextflow option, or register it as true respectively.
Actual:
≻ nextflow run MaxUlysse/nextflow_params_opt --opt "-foo"
Unknown option: -foo -- Check the available commands and options and syntax with 'help'
≻ nextflow run MaxUlysse/nextflow_params_opt --opt "--foo"
N E X T F L O W ~ version 20.05.0-edge
Launching `MaxUlysse/nextflow_params_opt` [reverent_bartik] - revision: 5aa15fb9f0 [master]
executor > local (1)
[37/01f0a2] process > test [100%] 1 of 1 ✔
true
Expected:
≻ nextflow run MaxUlysse/nextflow_params_opt --opt "-foo"
N E X T F L O W ~ version 20.05.0-edge
Launching `MaxUlysse/nextflow_params_opt` [reverent_bartik] - revision: 5aa15fb9f0 [master]
executor > local (1)
[37/01f0a2] process > test [100%] 1 of 1 ✔
-foo
≻ nextflow run MaxUlysse/nextflow_params_opt --opt "--foo"
N E X T F L O W ~ version 20.05.0-edge
Launching `MaxUlysse/nextflow_params_opt` [reverent_bartik] - revision: 5aa15fb9f0 [master]
executor > local (1)
[37/01f0a2] process > test [100%] 1 of 1 ✔
--foo
Managed to have the expected behaviour using an =:
≻ nextflow run MaxUlysse/nextflow_params_opt --opt="-foo"
N E X T F L O W ~ version 20.05.0-edge
Launching `MaxUlysse/nextflow_params_opt` [deadly_chandrasekhar] - revision: 5aa15fb9f0 [master]
executor > local (1)
[ce/d776c8] process > test [100%] 1 of 1 ✔
-foo
≻ nextflow run MaxUlysse/nextflow_params_opt --opt="--foo"
N E X T F L O W ~ version 20.05.0-edge
Launching `MaxUlysse/nextflow_params_opt` [disturbed_mandelbrot] - revision: 5aa15fb9f0 [master]
executor > local (1)
[c3/20ee15] process > test [100%] 1 of 1 ✔
--foo
nextflow run MaxUlysse/nextflow_params_opt --opt "-foo"
nextflow run MaxUlysse/nextflow_params_opt --opt "--foo"
(Copy and paste here output produced by the failing execution. Please highlight it as a code block. Whenever possible upload the .nextflow.log file.)
zsh 5.4.2 (x86_64-ubuntu-linux-gnu))(Add any other context about the problem here)
reproduced on GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
I fear this is a .. feature! 😱
The " does nothing here, the quotes are not even passed to the NF runtime.

The logic behind is that an option is followed by a -string, this sequence is interpreted as the following cli params, and the prevision as a boolean params flag implicitly true.
Cannot do anything, other than rewriting the CLI interpreter #556.
Most helpful comment
I fear this is a .. feature! 😱