Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
wp menu item get command
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the wp menu item get command, a valuable addition for retrieving details of a specific menu item. The implementation is solid and includes comprehensive test coverage. However, there's an inconsistency in the default fields displayed by the command. The code defaults to showing all available fields, while the documentation example and tests expect a more concise, curated list. My feedback focuses on aligning the implementation with the documentation and tests to improve user experience and maintain consistency with the list command.
src/Menu_Item_Command.php
Outdated
There was a problem hiding this comment.
The current implementation sets the default fields to all available fields. This contradicts the command's own documentation example and the accompanying tests, which expect a smaller default set of fields (db_id, type, title, link, position). While the tests may pass if they only check for the presence of rows, this behavior is inconsistent and not ideal for the user. To fix this, the default fields should be sourced from $this->obj_fields for consistency with the list command.
$assoc_args['fields'] = $this->obj_fields;
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Plan for implementing
wp menu item getcommandgetmethod in Menu_Item_Command.phpChanges Applied
Default Fields Update
--fieldsparameter description to specify it defaults todb_id, type, title, link, position$obj_fieldsclass propertywp menu item listcommand--fields=allOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.