-
Notifications
You must be signed in to change notification settings - Fork 427
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
Create empty Map for Map @Option in command methods #533
Comments
The convention in picocli is to not modify annotated fields (or parameters) that weren’t matched on the command line, unless a default value was specified. For object fields this means that if they’re declared without an initial value, they stay Do you feel like providing a pull request to improve the documentation? (No need to change the HTML file, it is generated from the |
@bobtiernay-okta Does this answer your question? |
Yes it does thanks. Sorry, I planned to say I would help add a note to the docs. Might be able to get to it later in the week. Thanks! |
That would be great, thanks! |
So I'm trying to update the documentation but I'm struggling to square the existing docs:
with your comment above:
In the case of an |
I created a test to demonstrate the current behaviour and actually found a bug. :-) The test is in the issue I created: #538 The test shows the expected behaviour:
In the case of fields, it's similar, but slightly more complex because fields can have an initial value in their declaration, for example:
Also, when the option is matched, for
|
Did my last comment answer your question? |
Early warning: I’m planning to do a release in a week or so. If you can provide any doc improvements this week they will be included in the upcoming release. Of course there will be other releases if that’s too soon. |
Will try to get to this tomorrow or Monday. |
Great, thanks! |
Hi @bobtiernay-okta, I saw the PR on #545, thank you! Is this ready to be merged and are you happy to close this ticket when #545 is merged or are there more changes in the pipeline? |
I think its good enough for now. I was going to add more detail but it really didn't fit in that section. I'll try to contribute a more substantial piece next time! |
Understood. I merged to PR. Do you want to keep this ticket open? |
Currently the following will result in a
null
Map
being passed to the method:From the docs:
However this is isn't a field so the expectation is unclear. Ideally this would be initialized to an empty Map. Updating the documentation to account for command methods would also be useful.
The text was updated successfully, but these errors were encountered: