-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature request: PropertiesDefaultProvider at first try to load properties from classpath #2102
Comments
That sounds like a good enhancement! My time to work on picocli is extremely limited. |
I understood your opinion. But the oposite order is for us problematic. If you pass the loading defaults from classpath as last in order then you always override user defined settings. But if I look on it from implementation. You are right first is current code and after this is load from classpath. So theoreticaly this way:
|
I think we’re on the same page. We want applications to be able to bundle default values in their jar, but users need to be able to override the location and specify their own defaults. I’m on my phone and can’t check the code but the documentation doesn’t seem to mention the ability to specify a path via an environment variable. I don’t oppose this but we’d need to implement, test and document this also. Do you want to provide a pull request for this?
Thoughts? |
ad 1) ok no problem ad 2) yes this come to my mind to. In our case it is all in one fat jar made by maven, but I see in docu that picocli.jar could be separate jar so wasn't sure how it works. The command class is 100% better, just I didn't look yet how get it from CommandSpec object. ad 3) not sure what you mean. The original logic try to load from -Dpicocli.defaults..path, and if not present then from user.home This is still present. ad 4) I expect no exception as not always user of picocli want provide some defaults on classpath. I see some warning in createProperties will not be enough? In general I created PR #2107 to discuss directly on code |
… from classpath - check if commandSpec.userObject is null
… from classpath - addded test for read default values from resource classpath
…classpath - check if commandSpec.userObject is null
…classpath - addded test for read default values from resource classpath
Would be possible enhance this class to load properties from resources too?
Actual state:
Wanted state:
or allow configure IDefaultValueProviders as ordered list?
The text was updated successfully, but these errors were encountered: