Closed frederic-mahe closed 7 years ago
I guess I kind of like the idea of throwing an error and stopping. I feel like duplicate flags might be a mistake made by new users, and throwing an error would force them to find it and fix it. They might miss this if the script completes silently or if it's only in the man page, which new users rarely read.
In a more general sense, should duplicated parameters be accepted for other options?
swarm -i example.fna -d 1 -d 2 > output.txt
Are non-existent parameters accepted?
swarm -i example.fna --biomout example.biom
If you only accept valid and unambiguous flags, the opportunity of confusion is reduced.
Ideally it should complain if the same option is passed more than once. It will complain now if non-existing options are specified.
This behaviour could be implemented with a bool array (bitmap) indicating which options are specified, and by checking if each option has already been encountered.
See also issue #77
Duplicated options now trigger a fatal error with this message: Error: Option -x or --xxxxxx specified more than once.
Perfect. Passing non-existing or duplicated options is already covered by unit tests, so I think we can close that issue.
hello, what should swarm do if an option is passed twice?
as of now, swarm does not complain and writes in
file2
. I am perfectly OK with that, but other tools behave differently:I don't know what is the best way to behave. Should swarm issue a warning and keep running? Either way, that behavior should be documented in the man page, something like "if the same option is passed twice, only the value of the last option is retained".
What do you think?