mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
patch keys parse command (#700)
This commit is contained in:
parent
e1ad9569a7
commit
9472c09b91
@ -46,12 +46,25 @@ func getModifiedKeysCmd() *cobra.Command {
|
|||||||
for _, c := range keysCmd.Commands() {
|
for _, c := range keysCmd.Commands() {
|
||||||
if c.Name() == "add" {
|
if c.Name() == "add" {
|
||||||
monkeyPatchCmdKeysAdd(c)
|
monkeyPatchCmdKeysAdd(c)
|
||||||
break
|
}
|
||||||
|
if c.Name() == "parse" {
|
||||||
|
monkeyPatchCmdKeysParse(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return keysCmd
|
return keysCmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func monkeyPatchCmdKeysParse(keysParseCmd *cobra.Command) {
|
||||||
|
|
||||||
|
// replace the run function with a wrapped version that sets the old coin type in the global config
|
||||||
|
oldRun := keysParseCmd.RunE
|
||||||
|
keysParseCmd.RunE = func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
||||||
|
sdk.GetConfig().Seal()
|
||||||
|
return oldRun(cmd, args)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// monkeyPatchCmdKeysAdd modifies the `keys add` command to use the old bip44 coin type when a flag is passed.
|
// monkeyPatchCmdKeysAdd modifies the `keys add` command to use the old bip44 coin type when a flag is passed.
|
||||||
func monkeyPatchCmdKeysAdd(keysAddCmd *cobra.Command) {
|
func monkeyPatchCmdKeysAdd(keysAddCmd *cobra.Command) {
|
||||||
// add flag
|
// add flag
|
||||||
|
Loading…
Reference in New Issue
Block a user