feat(x/feegrant): add autocli options for tx (backport #17959) (#18013)

Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
mergify[bot]
2023-10-09 14:18:07 +02:00
committed by GitHub
co-authored by Julien Robert
parent b0d20bce2b
commit daaff088e2
8 changed files with 37 additions and 144 deletions
+7
View File
@@ -11,12 +11,19 @@ import (
// findSubCommand finds a sub-command of the provided command whose Use
// string is or begins with the provided subCmdName.
// It verifies the command's aliases as well.
func findSubCommand(cmd *cobra.Command, subCmdName string) *cobra.Command {
for _, subCmd := range cmd.Commands() {
use := subCmd.Use
if use == subCmdName || strings.HasPrefix(use, subCmdName+" ") {
return subCmd
}
for _, alias := range subCmd.Aliases {
if alias == subCmdName || strings.HasPrefix(alias, subCmdName+" ") {
return subCmd
}
}
}
return nil
}