Skip to content
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

Consider disabling jopt short option clustering in Barclay Parser #119

Open
cmnbroad opened this issue Dec 12, 2017 · 5 comments
Open

Consider disabling jopt short option clustering in Barclay Parser #119

cmnbroad opened this issue Dec 12, 2017 · 5 comments
Assignees

Comments

@cmnbroad
Copy link
Collaborator

cmnbroad commented Dec 12, 2017

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.

@cmnbroad cmnbroad changed the title Disable jopt short option clustering Consider disabling jopt short option clustering in Barclay Parser Dec 12, 2017
@jamesemery
Copy link
Contributor

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

@magicDGS
Copy link
Contributor

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

@droazen
Copy link
Contributor

droazen commented Apr 25, 2018

👍 to disabling clustering

@cmnbroad
Copy link
Collaborator Author

@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.

@lbergelson
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants