fix(wsh): prevent deleteblock from silently ignoring positional arguments#3419
fix(wsh): prevent deleteblock from silently ignoring positional arguments#3419Jason-Shen2 wants to merge 1 commit into
Conversation
…ents - Add Args: cobra.NoArgs to reject accidental positional block IDs - Add proper Use/Long documentation for the -b flag - Align with focusblock command pattern When users passed a block ID as a positional argument (e.g. 'wsh deleteblock BLOCKID' instead of 'wsh deleteblock -b BLOCKID'), the argument was silently ignored and the command defaulted to deleting the current block. Adding Args validation causes cobra to reject positional arguments with an error, and the improved documentation clarifies the correct usage. Fixes wavetermdev#3417
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis change updates the Estimated code review effort: 1 (Trivial) | ~2 minutes Changes
Related issues: None found. Related PRs: None found. Suggested labels: documentation Suggested reviewers: None found. 🐰 A tiny hop, a help text spruced, 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Fixes #3417
The
wsh deleteblockcommand had two issues:Usestring didn't document the-bflag, making it unclear how to specify which block to deleteArgsvalidation, positional arguments were silently ignored. When users passed a block ID as a positional argument (e.g.wsh deleteblock BLOCKIDinstead ofwsh deleteblock -b BLOCKID), the argument was ignored and the command defaulted to deleting the current block ("this"), causing it to "close itself."Changes
Usestring todeleteblock [-b {blockid|blocknum|this}]to document the-bflag (matching thefocusblockcommand pattern)Longdescription clarifying default behaviorArgs: cobra.NoArgsto reject accidental positional arguments with a clear error instead of silently ignoring themTesting
go build ./cmd/wsh/compiles successfullygo vet ./cmd/wsh/...passeswsh deleteblock --helpshows correct usage with-bflag documentedwsh deleteblock BLOCKID(positional) now returns an error instead of silently deleting the current block