Skip to content

Commit 2404bfb

Browse files
committed
Merge branch 'feat/executor' of https://github.com/initia-labs/opinit-bots-go into feat/executor
2 parents a62d73d + 19b994c commit 2404bfb

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

cmd/opinitd/key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func keysAddCmd(ctx *cmdContext) *cobra.Command {
6868
Example: strings.TrimSpace(`
6969
$ keys add localnet key1
7070
$ keys add l2 key2 --bech32 celestia
71-
$ keys add l2 key2 --restore mnemonic.txt`),
71+
$ keys add l2 key2 --recover --source mnemonic.txt`),
7272
RunE: func(cmd *cobra.Command, args []string) error {
7373
chainId := args[0]
7474
keyName := args[1]

cmd/opinitd/main.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

cmd/opinitd/reset.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package main
2+
3+
import (
4+
"os"
5+
"path"
6+
7+
"github.com/spf13/cobra"
8+
9+
bottypes "github.com/initia-labs/opinit-bots-go/bot/types"
10+
)
11+
12+
func resetStateCmd(ctx *cmdContext) *cobra.Command {
13+
cmd := &cobra.Command{
14+
Use: "reset-db [bot-name]",
15+
Args: cobra.ExactArgs(1),
16+
Short: "Reset a bot's db.",
17+
Long: `Reset a bot's db.
18+
`,
19+
RunE: func(cmd *cobra.Command, args []string) error {
20+
botType := bottypes.BotTypeFromString(args[0])
21+
switch botType {
22+
case bottypes.BotTypeExecutor:
23+
dbPath := path.Join(ctx.homePath, string(botType))
24+
err := os.RemoveAll(dbPath + ".db")
25+
if err != nil {
26+
return err
27+
}
28+
err = os.Remove(path.Join(ctx.homePath, "batch"))
29+
if err != nil {
30+
return err
31+
}
32+
}
33+
return nil
34+
},
35+
}
36+
return cmd
37+
}

cmd/opinitd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func NewRootCmd() *cobra.Command {
4545
initCmd(ctx),
4646
startCmd(ctx),
4747
keysCmd(ctx),
48+
resetStateCmd(ctx),
4849
version.NewVersionCommand(),
4950
)
5051

0 commit comments

Comments
 (0)