github.com/cosmos/cosmos-sdk@v0.50.10/client/snapshot/delete.go (about) 1 package snapshot 2 3 import ( 4 "strconv" 5 6 "github.com/spf13/cobra" 7 8 "github.com/cosmos/cosmos-sdk/server" 9 ) 10 11 func DeleteSnapshotCmd() *cobra.Command { 12 return &cobra.Command{ 13 Use: "delete <height> <format>", 14 Short: "Delete a local snapshot", 15 Args: cobra.ExactArgs(2), 16 RunE: func(cmd *cobra.Command, args []string) error { 17 ctx := server.GetServerContextFromCmd(cmd) 18 19 height, err := strconv.ParseUint(args[0], 10, 64) 20 if err != nil { 21 return err 22 } 23 format, err := strconv.ParseUint(args[1], 10, 32) 24 if err != nil { 25 return err 26 } 27 28 snapshotStore, err := server.GetSnapshotStore(ctx.Viper) 29 if err != nil { 30 return err 31 } 32 33 return snapshotStore.Delete(height, uint32(format)) 34 }, 35 } 36 }