You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: cmd/XDC/dbcmd.go
+14-39Lines changed: 14 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -20,6 +20,7 @@ import (
20
20
"fmt"
21
21
"os"
22
22
"path/filepath"
23
+
"slices"
23
24
"time"
24
25
25
26
"github.com/XinFinOrg/XDPoSChain/cmd/utils"
@@ -38,9 +39,7 @@ var (
38
39
Name: "removedb",
39
40
Usage: "Remove blockchain and state databases",
40
41
ArgsUsage: " ",
41
-
Flags: []cli.Flag{
42
-
utils.DataDirFlag,
43
-
},
42
+
Flags: utils.DatabaseFlags,
44
43
Description: `
45
44
Remove blockchain and state databases`,
46
45
}
@@ -61,41 +60,29 @@ Remove blockchain and state databases`,
61
60
Action: inspect,
62
61
Name: "inspect",
63
62
ArgsUsage: "<prefix> <start>",
64
-
Flags: []cli.Flag{
65
-
utils.DataDirFlag,
63
+
Flags: slices.Concat([]cli.Flag{
66
64
utils.SyncModeFlag,
67
-
utils.MainnetFlag,
68
-
utils.TestnetFlag,
69
-
utils.DevnetFlag,
70
-
},
65
+
}, utils.NetworkFlags, utils.DatabaseFlags),
71
66
Usage: "Inspect the storage size for each type of data in the database",
72
67
Description: `This commands iterates the entire database. If the optional 'prefix' and 'start' arguments are provided, then the iteration is limited to the given subset of data.`,
73
68
}
74
69
dbStatCmd=&cli.Command{
75
70
Action: dbStats,
76
71
Name: "stats",
77
72
Usage: "Print leveldb statistics",
78
-
Flags: []cli.Flag{
79
-
utils.DataDirFlag,
73
+
Flags: slices.Concat([]cli.Flag{
80
74
utils.SyncModeFlag,
81
-
utils.MainnetFlag,
82
-
utils.TestnetFlag,
83
-
utils.DevnetFlag,
84
-
},
75
+
}, utils.NetworkFlags, utils.DatabaseFlags),
85
76
}
86
77
dbCompactCmd=&cli.Command{
87
78
Action: dbCompact,
88
79
Name: "compact",
89
80
Usage: "Compact leveldb database. WARNING: May take a very long time",
90
-
Flags: []cli.Flag{
91
-
utils.DataDirFlag,
81
+
Flags: slices.Concat([]cli.Flag{
92
82
utils.SyncModeFlag,
93
-
utils.MainnetFlag,
94
-
utils.TestnetFlag,
95
-
utils.DevnetFlag,
96
83
utils.CacheFlag,
97
84
utils.CacheDatabaseFlag,
98
-
},
85
+
},utils.NetworkFlags, utils.DatabaseFlags),
99
86
Description: `This command performs a database compaction.
100
87
WARNING: This operation may take a very long time to finish, and may cause database
101
88
corruption if it is aborted during execution'!`,
@@ -105,27 +92,19 @@ corruption if it is aborted during execution'!`,
105
92
Name: "get",
106
93
Usage: "Show the value of a database key",
107
94
ArgsUsage: "<hex-encoded key>",
108
-
Flags: []cli.Flag{
109
-
utils.DataDirFlag,
95
+
Flags: slices.Concat([]cli.Flag{
110
96
utils.SyncModeFlag,
111
-
utils.MainnetFlag,
112
-
utils.TestnetFlag,
113
-
utils.DevnetFlag,
114
-
},
97
+
}, utils.NetworkFlags, utils.DatabaseFlags),
115
98
Description: "This command looks up the specified database key from the database.",
116
99
}
117
100
dbDeleteCmd=&cli.Command{
118
101
Action: dbDelete,
119
102
Name: "delete",
120
103
Usage: "Delete a database key (WARNING: may corrupt your database)",
121
104
ArgsUsage: "<hex-encoded key>",
122
-
Flags: []cli.Flag{
123
-
utils.DataDirFlag,
105
+
Flags: slices.Concat([]cli.Flag{
124
106
utils.SyncModeFlag,
125
-
utils.MainnetFlag,
126
-
utils.TestnetFlag,
127
-
utils.DevnetFlag,
128
-
},
107
+
}, utils.NetworkFlags, utils.DatabaseFlags),
129
108
Description: `This command deletes the specified database key from the database.
130
109
WARNING: This is a low-level operation which may cause database corruption!`,
131
110
}
@@ -134,13 +113,9 @@ WARNING: This is a low-level operation which may cause database corruption!`,
134
113
Name: "put",
135
114
Usage: "Set the value of a database key (WARNING: may corrupt your database)",
0 commit comments