Skip to content

Conversation

Copy link

Copilot AI commented Dec 24, 2025

  • Understand the existing implementation of --format flag in plugin/theme install commands
  • Add --format parameter to core install command documentation
  • Implement format handling in core install method
  • Add tests for --format flag with core install command
  • Address code review feedback
  • Fix failing test by removing default value from --format parameter
  • Simplify format handling code
  • Run security checks

Summary

This PR successfully adds support for the --format argument to the wp language core install command, matching the functionality implemented for plugin and theme commands in PR #64.

Implementation Details

The implementation:

  • Only outputs formatted results when --format flag is explicitly provided
  • Preserves backward compatibility - commands without --format behave exactly as before
  • Supports table, csv, json, and summary formats
  • Uses quiet logger for csv and json formats to provide clean, parseable output
  • No default value to ensure opt-in behavior

Test Coverage

  • ✅ Added comprehensive Behat tests for all format types
  • ✅ Existing tests pass without modification (backward compatible)
  • ✅ Tests cover CSV, JSON, table, and summary formats
  • ✅ Edge cases like invalid language codes are handled

Code Quality

  • ✅ PHP linting
  • ✅ PHPCS code style
  • ✅ PHPStan static analysis
  • ✅ CodeQL security scan
Original prompt

This section details on the original issue you should resolve

<issue_title>Add support for --format argument to core install command</issue_title>
<issue_description>Support for theme/plugin commands were added in #64. Let's do the same for core install.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 24, 2025 10:03
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 support for --format argument to core install command Add --format support to language core install command Dec 24, 2025
Copilot AI requested a review from swissspidy December 24, 2025 10:07
@swissspidy

This comment was marked as resolved.

…rovided

The previous implementation always outputted formatted tables, breaking
existing tests. Now format output is only shown when user explicitly
provides --format flag, preserving backward compatibility.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copy link
Author

Copilot AI commented Dec 24, 2025

@copilot Failing test:

...

Fixed in de911ad. The issue was that formatted output was being displayed even when --format wasn't explicitly provided. Now the formatted table is only shown when the user provides the --format flag, preserving backward compatibility with existing behavior.

@swissspidy

This comment was marked as resolved.

Copilot AI and others added 2 commits December 24, 2025 12:54
WP-CLI's parameter parser uses the 'default' value in docblocks to
automatically populate parameters. Removing 'default: table' ensures
--format is only set when explicitly provided by the user, preserving
backward compatibility with existing commands that don't use --format.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Since WP-CLI validates format parameter values, there's no need to
check for empty values and set a default. The format value will always
be valid when isset() returns true.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Core_Language_Command.php 90.90% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for --format argument to core install command

2 participants