cosmos-sdk/client/snapshot/delete.go
Julien Robert c452721442
style: add gci linter (#16758)
Co-authored-by: Jacob Gadikian <faddat@users.noreply.github.com>
2023-06-29 09:46:37 +00:00

37 lines
729 B
Go

package snapshot
import (
"strconv"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/server"
)
func DeleteSnapshotCmd() *cobra.Command {
return &cobra.Command{
Use: "delete <height> <format>",
Short: "Delete a local snapshot",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
ctx := server.GetServerContextFromCmd(cmd)
height, err := strconv.ParseUint(args[0], 10, 64)
if err != nil {
return err
}
format, err := strconv.ParseUint(args[1], 10, 32)
if err != nil {
return err
}
snapshotStore, err := server.GetSnapshotStore(ctx.Viper)
if err != nil {
return err
}
return snapshotStore.Delete(height, uint32(format))
},
}
}