From 6e7f625a48c9a0a6187455e36f9a1c051f7e3204 Mon Sep 17 00:00:00 2001 From: zhangkai Date: Wed, 24 May 2023 13:53:23 +0800 Subject: [PATCH] fix iaviewer prefix --- cmd/okbchaind/iaviewer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/okbchaind/iaviewer.go b/cmd/okbchaind/iaviewer.go index eca41113d..1c7dc087b 100644 --- a/cmd/okbchaind/iaviewer.go +++ b/cmd/okbchaind/iaviewer.go @@ -214,6 +214,10 @@ func iaviewerReadCmd(ctx *iaviewerContext) *cobra.Command { cmd.PersistentFlags().String(flagKey, "", "print only the value for this key, key must be in hex format.\n"+ "if specified, keyprefix, start and limit flags would be ignored") cmd.PersistentFlags().String(flagKeyPrefix, "", "print values for keys with specified prefix, prefix must be in hex format.") + viper.BindPFlag(flagKeyPrefix, cmd.PersistentFlags().Lookup(flagKeyPrefix)) + viper.BindPFlag(flagHex, cmd.PersistentFlags().Lookup(flagHex)) + viper.BindPFlag(flagKey, cmd.PersistentFlags().Lookup(flagKey)) + return cmd } @@ -231,6 +235,7 @@ func iaviewerReadNodeCmd(ctx *iaviewerContext) *cobra.Command { }, } cmd.PersistentFlags().String(flagNodeHash, "", "print only the value for this hash, key must be in hex format.") + viper.BindPFlag(flagNodeHash, cmd.PersistentFlags().Lookup(flagNodeHash)) return cmd } @@ -317,6 +322,8 @@ func iaviewerDiffCmd(ctx *iaviewerContext) *cobra.Command { } cmd.PersistentFlags().Bool(flagHex, false, "print key and value in hex format") cmd.PersistentFlags().String(flagKeyPrefix, "", "diff values for keys with specified prefix, prefix must be in hex format.") + viper.BindPFlag(flagHex, cmd.PersistentFlags().Lookup(flagHex)) + viper.BindPFlag(flagKeyPrefix, cmd.PersistentFlags().Lookup(flagKeyPrefix)) return cmd }