-
Notifications
You must be signed in to change notification settings - Fork 25
Add --format flag to language update commands
#170
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
Open
Copilot
wants to merge
15
commits into
main
Choose a base branch
from
copilot/add-format-flag-to-update-commands
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add --format flag to language update commands
Add --format flag to language update commands
Nov 2, 2025
Copilot finished work on behalf of
swissspidy
November 2, 2025 17:31
This comment was marked as resolved.
This comment was marked as resolved.
…ixtures Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Copilot finished work on behalf of
swissspidy
November 3, 2025 08:35
This comment was marked as resolved.
This comment was marked as resolved.
…l updates Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Copilot finished work on behalf of
swissspidy
November 3, 2025 08:56
This comment was marked as resolved.
This comment was marked as resolved.
…nstall commands Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Copilot finished work on behalf of
swissspidy
November 3, 2025 09:46
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.
Copilot finished work on behalf of
swissspidy
November 3, 2025 12:37
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.
Copilot finished work on behalf of
swissspidy
November 3, 2025 13:11
This comment was marked as resolved.
This comment was marked as resolved.
…theme test Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Copilot finished work on behalf of
swissspidy
November 3, 2025 13:31
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
--format flag to language update commands
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add --format Flag to Language Update Commands
This PR adds support for the
--formatflag to the language update commands, resolving the issue where the--jsonflag (which WP-CLI automatically converts to--format=jsonfor backward compatibility) was generating errors.Problem Statement
The issue reported that all update commands for language files with
--jsongenerate an error:This was because the update commands didn't support the
--formatflag, even though WP-CLI was converting--jsonto--format=jsonautomatically.Solution
Added
--formatflag support to:wp language core updatewp language plugin updatewp language theme updateSupported Formats
table(default) - Display results in table format with progress messages and success messagejson- Display results as JSON (suppresses all messages)csv- Display results as CSV (suppresses all messages)summary- Display only summary message without formatted outputImplementation Details
Code Changes:
CommandWithTranslation.php: Updated the
update()method to:--formatparameter in the method signatureWP_CLI::log()instead ofWP_CLI::line()for proper quiet logger supportCore_Language_Command.php: Added
--formatparameter documentation to theupdatecommand docblockPlugin_Language_Command.php: Added
--formatparameter documentation to theupdatecommand docblockTheme_Language_Command.php: Added
--formatparameter documentation to theupdatecommand docblockTest Coverage:
Added comprehensive Behat test scenarios for all three commands:
Tests with no updates:
--format=jsonoutputs empty JSON array, no messages--format=csvoutputs nothing--format=summaryshows success message on STDOUTTests with actual updates:
Key Features:
✅ Backward compatibility with
--jsonflag (automatically converted to--format=json)✅ Consistent behavior with other language commands (install, uninstall, list)
✅ Proper quiet logger support for json/csv formats
✅ Success messages shown for table/summary formats or when no format is specified
✅ Dry-run message shown for table/summary/no format, suppressed for json/csv
✅ Efficient data collection (skips when not needed for summary format)
✅ Correct output for empty results
✅ Works with both
--dry-runand actual updatesChanges from Feedback:
--forceflag from language install commands in testsWhen I tryThe implementation is ready for review and testing in a live WP-CLI environment.
Original prompt
--formatflag tolanguage core|plugin|theme update#88✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.