broadinstitute/barclay

Consider disabling jopt short option clustering in Barclay Parser

Opened this issue · 5 comments

We should consider disabling the jopt feature of trying to interpret short options as clusters (i.e., "-abc" will be interpreted as "-a -b -c" if there is no short option named "abc") since it can have surprising consequences. If a tool has two args with short names "-0" and "-OVI", then "-OVI can be provided on the command line as a short name. If the tool has no short arg named "OVI", "-OVI" will be interpreted as "-O", "-V", "-I", with various failure modes ensuing based on the legitimacy of those names.

I second this, I have just run into this problem and its causing Barclay error messages related to missing arguments to be unhelpful

I vote for solving this asap, otherwise users get confused by the error messages in any downstream project!

👍 to disabling clustering

@droazen I've looked into this before, and recently again - and jopt doesn't appear to have a supported way to opt out of short arg clustering. We could detect and transform the error message in the exception for this case, but that would be awkward and brittle.

I hacked together a solution that requires injecting a class into the jopt package namespace, which allows me to override an otherwise package protected method. Its pretty simple and seems to work.

I suspect jopt would accept a patch that adds a toggle for clustering. We could probably push it upstream if we want.