Skip to content

Fix PowerShell argument handling in spam-comment deletion example - #665

Open
qorud02 wants to merge 1 commit into
wp-cli:mainfrom
qorud02:codex/powershell-spam-comment-ids
Open

qorud02 wants to merge 1 commit into
wp-cli:mainfrom
qorud02:codex/powershell-spam-comment-ids

Conversation

@qorud02

@qorud02 qorud02 commented Oct 2, 2026 •

Copy link
Copy Markdown

The spam-comment deletion example currently tells Windows users to run the same $(...) command in PowerShell. With multiple IDs on one output line, PowerShell passes a single argument such as "11 22" to WP-CLI instead of the two ID arguments "11" and "22".

Add a PowerShell example that splits the ID list on whitespace and skips deletion when the list is empty. Keep the existing Bash example and identify the shells it supports.

Fixes #664.

Validation: executed the original and corrected examples in Windows PowerShell 5.1.26100.9549 and PowerShell 7.6.5 through WP-CLI 2.12.0 / PHP 8.4.26 on Windows 11. A non-destructive before_wp_load command fixture reports the arguments received. Checked two IDs, one ID, and no IDs. The fixture exercises real WP-CLI argument parsing without deleting database records. git diff --check also passes.

AI assistance: OpenAI Codex helped reproduce the shell behavior and prepare this documentation change and its tests.

Summary by CodeRabbit

  • Documentation
    • Clarified that the spam-comment deletion command works in bash-compatible shells but not Windows Command Prompt.
    • Added a PowerShell alternative that handles returned IDs separately and skips deletion when none are found.

@qorud02
qorud02 requested a review from a team as a code owner October 2, 2026 01:47
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 47415382-4dbd-419d-84b9-9425323685e8

📥 Commits

Reviewing files that changed from the base of the PR and between 823baff and 766c823.

📒 Files selected for processing (1)
  • guides/common-tasks.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The spam-comment deletion guide now distinguishes bash-compatible shell behavior from Windows Command Prompt behavior. It adds a PowerShell example that splits returned IDs and skips deletion when no IDs are present.

Changes

Spam-comment deletion guidance

Layer / File(s) Summary
Shell-specific deletion examples
guides/common-tasks.md
The guide retains the existing command for bash-compatible shells, notes that it does not work in Windows Command Prompt, and adds a PowerShell example that splits IDs and checks for an empty list.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other · Severity of issue fixed: Low

Suggested reviewers: brianhenryie

Merge Risk: ⚪ Minimal · up to 766c8

The new PowerShell guidance handles multiple, single, and empty ID lists, while the Bash example remains available for compatible shells. No merge-blocking issue was identified.

Architecture Summary

Architecture risk: 🔵 Low · up to 766c8

The change affects 1 system.

Changed systems: guides

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — guides (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in guides/common-tasks.md: Replaced a note directing Windows users to Git Bash, WSL, or PowerShell with guidance that the existing command works in bash-compatible shells but not Command Prompt, plus a PowerShell example that splits whitespace-separated IDs and runs deletion only when the resulting ID list is nonempty.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: correcting PowerShell argument handling in the spam-comment deletion example.
Linked Issues check ✅ Passed The PR addresses all coding requirements in issue #664. It retains the Bash example in guides/common-tasks.md. It adds a PowerShell example that splits whitespace-separated IDs into separate argumen…
Out of Scope Changes check ✅ Passed The change is limited to the spam-comment deletion documentation in guides/common-tasks.md. The shell-support note and the PowerShell guard directly clarify the behavior required by issue #664. No u…
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

No unresolved review issues remain.

Review effort: Lite
Findings: None

What changed in this PR

Updates the spam-comment deletion documentation with shell-specific examples, including safe PowerShell handling.

Changes:

  • Clarifies Bash-compatible shell support.
  • Adds PowerShell ID splitting and empty-result handling.
File Description
guides/​common-tasks.md Documents Bash and PowerShell deletion commands.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mon2000x111-sketch mon2000x111-sketch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mon2000x111-sketch mon2000x111-sketch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mon2000x111-sketch mon2000x111-sketch left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swissspidy

Copy link
Copy Markdown
Member

We should probably have a dedicated Windows page/section at some point

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.

PowerShell spam-comment deletion example passes multiple IDs as one argument

4 participants