From 7b0534f63127339bfd610cf50334296cdc4ee5ed Mon Sep 17 00:00:00 2001 From: "zhenxing.shen" Date: Wed, 8 Jul 2026 06:38:09 +0800 Subject: [PATCH] fix(wsh): prevent deleteblock from silently ignoring positional arguments - 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 #3417 --- cmd/wsh/cmd/wshcmd-deleteblock.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/wsh/cmd/wshcmd-deleteblock.go b/cmd/wsh/cmd/wshcmd-deleteblock.go index 76518e721c..0358d38c8d 100644 --- a/cmd/wsh/cmd/wshcmd-deleteblock.go +++ b/cmd/wsh/cmd/wshcmd-deleteblock.go @@ -12,8 +12,10 @@ import ( ) var deleteBlockCmd = &cobra.Command{ - Use: "deleteblock", + Use: "deleteblock [-b {blockid|blocknum|this}]", Short: "delete a block", + Long: "Delete a block. If no block is specified with -b, deletes the current block (this).", + Args: cobra.NoArgs, RunE: deleteBlockRun, PreRunE: preRunSetupRpcClient, }