Skip to content

Accept plaintext as an alias of var_export in cli param-dump#6339

Open
thisismyurl wants to merge 1 commit into
wp-cli:mainfrom
thisismyurl:fix/param-dump-accept-plaintext-format
Open

Accept plaintext as an alias of var_export in cli param-dump#6339
thisismyurl wants to merge 1 commit into
wp-cli:mainfrom
thisismyurl:fix/param-dump-accept-plaintext-format

Conversation

@thisismyurl

Copy link
Copy Markdown

plaintext and var_export are two names for the same plain-text output format across WP-CLI. The single-value formatters already register both names to the same handler, but cli param-dump does its own var_export( $spec ) and only checked for --format=var_export, so --format=plaintext silently fell through to JSON.

This accepts both names in param-dump and lists plaintext in the command's documented --format options, matching the suggestion on #4774 to accept both wherever that format is used. It is backward compatible: var_export keeps working and plaintext now works too.

To verify: wp cli param-dump --format=plaintext now emits the PHP var_export representation (e.g. 'path' =>) rather than JSON. A functional test in features/cli.feature covers it.

Refs #4774

(full disclosure: AI helped me identify the issue and verify my work)

`plaintext` and `var_export` are the same plain-text output format under two
names across WP-CLI commands. `cli param-dump` only honored `var_export`, so
`--format=plaintext` silently fell through to JSON. Accept both names (and list
`plaintext` in the documented options) so the format is consistent with the
single-value formatters, which already alias the two.

Adds a functional test asserting `--format=plaintext` emits the var_export
representation.

Refs wp-cli#4774
@thisismyurl thisismyurl requested a review from a team as a code owner June 30, 2026 12:40
@github-actions

Copy link
Copy Markdown
Contributor

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Here are some useful Composer commands to get you started:

  • composer install: Install dependencies.
  • composer test: Run the full test suite.
  • composer phpcs: Check for code style violations.
  • composer phpcbf: Automatically fix code style violations.
  • composer phpunit: Run unit tests.
  • composer behat: Run behavior-driven tests.

To run a single Behat test, you can use the following command:

# Run all tests in a single file
composer behat features/some-feature.feature

# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123

You can find a list of all available Behat steps in our handbook.

@github-actions github-actions Bot added command:cli Related to 'cli' command command:cli-param-dump Related to 'cli param-dump' command labels Jun 30, 2026
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 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

Labels

command:cli Related to 'cli' command command:cli-param-dump Related to 'cli param-dump' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant