-
Notifications
You must be signed in to change notification settings - Fork 425
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
Error: "value" not unique - when matching name and alias for same object #1537
Comments
Hi @StaffanArvidsson, thanks for raising this! Unfortunately I cannot reproduce the issue. Please take a look at the test I added.
Can you provide a way to reproduce the issue? |
@StaffanArvidsson probably means the following: int exitCode = new CommandLine(new MyCommand()).setAbbreviatedSubcommandsAllowed(true).execute("chem"); Which does give a user-friendly error message, but the result may be confusing to end-users:
I can create a pull request to get this fixed if needed. |
Yes @NewbieOrange is correct, I had set |
Thank you for your patience. I was finally able to reproduce the issue. 😅 Yes, I agree that it would be nice improvement to not fail when there are multiple matching candidate names which all reference the same command object (so there is no real ambiguity). @NewbieOrange if you can work on this, that would be great! 🙏 |
…ct as one match Fixes remkop#1537.
…ct as one match Fixes remkop#1537.
…ct as one match Fixes remkop#1537.
…ct as one match Fixes remkop#1537.
Found that having e.g. the
name
andaliases
begin with the same letters result in strange bahaviour when it comes to allowing abbreviated commands. Say I have the following snippet out of the generated usage text;and then running with
.. chem
will fail with the following stack trace (runningCommandLine.execute(String)
):I guess that's because the code builds up a Map<String,Object> of each name/alias and the AbbreviationMatcher doesn't check that they reference the same objects?
The text was updated successfully, but these errors were encountered: