Fixes for CLI-321#215
Conversation
Adds BeanUtils dependency to POM and implements TypeHandler using the BeanUtils classes. Handles all methods that were in the original TypeHandler as well as other default classes provided by BeanUtils. Test updated to show proper parsing of types that previously were not implemented. Includes new cli.converters package that may be better handled by BeanUtils as it moves forward to support FunctionalInterfaces.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #215 +/- ##
============================================
- Coverage 93.20% 91.72% -1.49%
+ Complexity 570 560 -10
============================================
Files 21 22 +1
Lines 1207 1220 +13
Branches 215 209 -6
============================================
- Hits 1125 1119 -6
- Misses 46 63 +17
- Partials 36 38 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I doubt we want to add a dependency on anything for Commons CLI, especially for what was meant to be a lightweight library. This would add Commons BeanUtils, Commons Logging, Commons Collections, and Commons Lang. It's a lot compared to JCommander and picocli... |
Added getParsedOptionValues methods with default values. Fixed som javadoc,
|
Added getParsedOptionValue methods with default values. Switched to ConvertUtilsBean2 for conversions. |
|
@garydgregory The code note was there and there is a lot of work in BeanUtils to make the conversions work cleanly. Might it be reasonable to make the dependency Optional so that if there is a wish to do BeanUtils (and other classes) are added, but for most cases it is not? Alternatively, we could remove the TypeHandler implementation and add a Predicate and a Function into the Option definition. The Predicate would be used to verify that the string argument is proper for the Function (a precheck if you will) to catch the error early. The Function to convert from String to Object. This should probably be the Func interface I added as it allows Exceptions to be thrown. I think this might be a lighter weight option. If this sounds reasonable I will work on it. |
|
Hello @Claudenw |
|
Reworked without BeanUtils as pull #216 I think that is a better solution. Will move forward with whichever version the community is happiest with. |
|
Closed in favor of #216 |
Adds BeanUtils dependency to POM and implements TypeHandler using the BeanUtils classes.
Handles all methods that were in the original TypeHandler as well as other default classes provided by BeanUtils. Test updated to show proper parsing of types that previously were not implemented.
Includes new cli.converters package that may be better handled by BeanUtils as it moves forward to support FunctionalInterfaces.