-
Notifications
You must be signed in to change notification settings - Fork 333
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
Main parameter doesn't support Converter #380
Comments
Fix wrks for me:
` |
Dear @juewe, Thanks for the fix for issue #380 but your fix breaks the tests ...
Best, JS |
Hi Jeremy, Created a patch (simply delete the ".txt" extension form file. Hope that helps... |
@juewe submit a PR |
FIX #380 Main parameter doesn't support Converter
This issue was fixed 9 months ago and there hasn't been a release since then... so I ran into the bug, too. @cbeust, will you be making a release? |
1.74 was released about a month ago: |
It looks like the problem was fixed in version 1.74. |
Thanks for adding converter capability to parse the main param: jcommander/src/main/java/com/beust/jcommander/JCommander.java Lines 766 to 771 in 0525445
However, the code does not work if we provide I noticed the solution above But the condition
prevents using the
However, to avoid breaking tests without the condition, should the |
The converter isn't called and I get an Exception:
Exception in thread "main" com.beust.jcommander.ParameterException: Could not invoke null
Reason: Can not set java.nio.file.Path field mypackage.MyCommand.file to java.lang.String
@Parameter(description = "File", converter = PathConverter.class)
private Path file;
(The PathConverter is from JCommander)
If I add a name to the Parameter (like -f) then the converter works like a charm.
Whole class:
MyCommand.txt
The text was updated successfully, but these errors were encountered: