Skip to content

Commit 8b517d7

Browse files
committed
cmd/geth: reorganise chain commands/flags
1 parent cad0710 commit 8b517d7

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

cmd/geth/chaincmd.go

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,63 +40,84 @@ import (
4040

4141
var (
4242
initCommand = cli.Command{
43-
Action: initGenesis,
43+
Action: utils.MigrateFlags(initGenesis),
4444
Name: "init",
4545
Usage: "Bootstrap and initialize a new genesis block",
4646
ArgsUsage: "<genesisPath>",
47-
Category: "BLOCKCHAIN COMMANDS",
47+
Flags: []cli.Flag{
48+
utils.DataDirFlag,
49+
utils.LightModeFlag,
50+
},
51+
Category: "BLOCKCHAIN COMMANDS",
4852
Description: `
4953
The init command initializes a new genesis block and definition for the network.
5054
This is a destructive action and changes the network in which you will be
5155
participating.
52-
`,
56+
57+
It expects the genesis file as argument.`,
5358
}
5459
importCommand = cli.Command{
55-
Action: importChain,
60+
Action: utils.MigrateFlags(importChain),
5661
Name: "import",
5762
Usage: "Import a blockchain file",
5863
ArgsUsage: "<filename> (<filename 2> ... <filename N>) ",
59-
Category: "BLOCKCHAIN COMMANDS",
64+
Flags: []cli.Flag{
65+
utils.DataDirFlag,
66+
utils.CacheFlag,
67+
utils.LightModeFlag,
68+
},
69+
Category: "BLOCKCHAIN COMMANDS",
6070
Description: `
6171
The import command imports blocks from an RLP-encoded form. The form can be one file
6272
with several RLP-encoded blocks, or several files can be used.
63-
If only one file is used, import error will result in failure. If several files are used,
64-
processing will proceed even if an individual RLP-file import failure occurs.
65-
`,
73+
74+
If only one file is used, import error will result in failure. If several files are used,
75+
processing will proceed even if an individual RLP-file import failure occurs.`,
6676
}
6777
exportCommand = cli.Command{
68-
Action: exportChain,
78+
Action: utils.MigrateFlags(exportChain),
6979
Name: "export",
7080
Usage: "Export blockchain into file",
7181
ArgsUsage: "<filename> [<blockNumFirst> <blockNumLast>]",
72-
Category: "BLOCKCHAIN COMMANDS",
82+
Flags: []cli.Flag{
83+
utils.DataDirFlag,
84+
utils.CacheFlag,
85+
utils.LightModeFlag,
86+
},
87+
Category: "BLOCKCHAIN COMMANDS",
7388
Description: `
7489
Requires a first argument of the file to write to.
7590
Optional second and third arguments control the first and
7691
last block to write. In this mode, the file will be appended
77-
if already existing.
78-
`,
92+
if already existing.`,
7993
}
8094
removedbCommand = cli.Command{
81-
Action: removeDB,
95+
Action: utils.MigrateFlags(removeDB),
8296
Name: "removedb",
8397
Usage: "Remove blockchain and state databases",
8498
ArgsUsage: " ",
85-
Category: "BLOCKCHAIN COMMANDS",
99+
Flags: []cli.Flag{
100+
utils.DataDirFlag,
101+
utils.LightModeFlag,
102+
},
103+
Category: "BLOCKCHAIN COMMANDS",
86104
Description: `
87-
TODO: Please write this
88-
`,
105+
Remove blockchain and state databases`,
89106
}
90107
dumpCommand = cli.Command{
91-
Action: dump,
108+
Action: utils.MigrateFlags(dump),
92109
Name: "dump",
93110
Usage: "Dump a specific block from storage",
94111
ArgsUsage: "[<blockHash> | <blockNum>]...",
95-
Category: "BLOCKCHAIN COMMANDS",
112+
Flags: []cli.Flag{
113+
utils.DataDirFlag,
114+
utils.CacheFlag,
115+
utils.LightModeFlag,
116+
},
117+
Category: "BLOCKCHAIN COMMANDS",
96118
Description: `
97119
The arguments are interpreted as block numbers or hashes.
98-
Use "ethereum dump 0" to dump the genesis block.
99-
`,
120+
Use "ethereum dump 0" to dump the genesis block.`,
100121
}
101122
)
102123

0 commit comments

Comments
 (0)