Skip to content

wp-env: Add --quiet option to destroy command#68787

Closed
jrmd wants to merge 5 commits intoWordPress:trunkfrom
jrmd:feature/wp-env-skip-confirmation
Closed

wp-env: Add --quiet option to destroy command#68787
jrmd wants to merge 5 commits intoWordPress:trunkfrom
jrmd:feature/wp-env-skip-confirmation

Conversation

@jrmd
Copy link
Copy Markdown
Contributor

@jrmd jrmd commented Jan 20, 2025

What?

This patch adds support for wp-env destroy --quiet which allows for the command to be ran silently and without the blocking confirmation prompt.

Why?

I am currently creating a script to run e2e tests across numerous plugins/repos all with their own individual e2e tests set up that need to be ran independently, when trying to run wp-env destroy within the script it requires a confirmation from stdin, forcing me to to write to stdin in a rather clunky way. By adding the skip confirmation option allows us to bypass this limitation allows the script to cleanup without issue.

How?

PR adds an optional argument to the destroy command which is used to silence all non-error output and skip blocking confirmation prompts. This patch lays some of the necessary foundation to implement across other commands too.

Testing Instructions

  1. run wp-env destroy --quiet
  2. see the confirmation isn't shown and the environment is destroyed as expected
  3. run wp-env destroy
  4. see the confirmation prompt is shown and works as previous

This patch adds support for `wp-env destroy --skip-confirmation` which
allows for the command to be ran without the blocking confirmation
prompt. Which easily allows this to be ran within scripts and on CI.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 20, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jrmd <jrmd@git.wordpress.org>
Co-authored-by: ObliviousHarmony <obliviousharmony@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 20, 2025
@github-actions
Copy link
Copy Markdown

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @jrmd! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Tool] Env /packages/env labels Jan 21, 2025
@ObliviousHarmony
Copy link
Copy Markdown
Contributor

I like this @jrmd, thank you! Before I test the PR out though, how would you feel about sticking to a more standard option like --silent/-s or --quiet/-q? I would probably lean towards silencing non-error output and auto-accepting any confirmation for the related command (if there is any).

@jrmd
Copy link
Copy Markdown
Contributor Author

jrmd commented Feb 21, 2025

@ObliviousHarmony definitely seems sensible to me :) i will make the necessary changes and update the pr :)

This patch changes the skip-confirmation option for wp-env destroy to
`--quiet` which also silences any non-error output along with auto
confirming options.

This change required a change in the withSpinner HOC due to the
.succeed at the end outputting the confirmation message but it does help
us in future to implement something for other commands
@jrmd jrmd changed the title wp-env: Add --skip-confirmation option to destroy command wp-env: Add --quiet option to destroy command Feb 21, 2025
@jrmd
Copy link
Copy Markdown
Contributor Author

jrmd commented Feb 21, 2025

@ObliviousHarmony Updated the pr to use the --quiet/-q 😄 let me know if you have any questions or issues.

ora itself returns an instance, with the addition of `--quiet` spinner
is no longer assigned to `spinner.start()` this mock has been updated to
return an instance to itself.
@jrmd jrmd closed this by deleting the head repository Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Tool] Env /packages/env [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants