From 412f4e719ea308b8e41833d7b8ebd2c085743ff7 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:28:07 +0200 Subject: [PATCH] fix(client/v2): correctly handle enhanced sub commands (backport #21809) (#21930) Co-authored-by: John Letey Co-authored-by: Julien Robert --- client/v2/CHANGELOG.md | 4 ++++ client/v2/autocli/msg.go | 4 +++- client/v2/autocli/query.go | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/v2/CHANGELOG.md b/client/v2/CHANGELOG.md index 36a91eff82e2..426244bc14ce 100644 --- a/client/v2/CHANGELOG.md +++ b/client/v2/CHANGELOG.md @@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* [#21809](https://github.com/cosmos/cosmos-sdk/pull/21809) Correctly handle enhanced sub commands. + ## [v2.0.0-beta.5] - 2024-09-18 ### Improvements diff --git a/client/v2/autocli/msg.go b/client/v2/autocli/msg.go index 5459c245a228..322fa6b26228 100644 --- a/client/v2/autocli/msg.go +++ b/client/v2/autocli/msg.go @@ -49,7 +49,9 @@ func (b *Builder) AddMsgServiceCommands(cmd *cobra.Command, cmdDescriptor *autoc return err } - cmd.AddCommand(subCmd) + if !subCmdDescriptor.EnhanceCustomCommand { + cmd.AddCommand(subCmd) + } } if cmdDescriptor.Service == "" { diff --git a/client/v2/autocli/query.go b/client/v2/autocli/query.go index 7e0f4cbc3185..dcb41bbfa25a 100644 --- a/client/v2/autocli/query.go +++ b/client/v2/autocli/query.go @@ -52,7 +52,9 @@ func (b *Builder) AddQueryServiceCommands(cmd *cobra.Command, cmdDescriptor *aut return err } - cmd.AddCommand(subCmd) + if !subCmdDesc.EnhanceCustomCommand { + cmd.AddCommand(subCmd) + } } // skip empty command descriptors