Swap to general export command

This commit is contained in:
Christopher Goes
2018-04-27 20:02:26 -04:00
committed by rigelrozanski
parent 55c82e44a2
commit f92e83d2e0
9 changed files with 122 additions and 41 deletions
-31
View File
@@ -1,31 +0,0 @@
package commands
import (
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/wire" // XXX fix
"github.com/cosmos/cosmos-sdk/x/stake"
)
// get the command to export state
func GetCmdExport(export func() (stake.GenesisState, error), cdc *wire.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "export-stake",
Short: "Export stake module state as JSON to stdout",
RunE: func(cmd *cobra.Command, args []string) error {
genesis, err := export()
if err != nil {
return err
}
output, err := wire.MarshalJSONIndent(cdc, genesis)
if err != nil {
return err
}
fmt.Println(string(output))
return nil
},
}
return cmd
}