chg: changes for import/export command

This commit is contained in:
Jaynti Kanani 2020-11-18 17:56:09 +05:30
parent 8c7cf1d64f
commit 2bd4ad3928
No known key found for this signature in database
GPG key ID: 4396982C976BAE5E

View file

@ -274,7 +274,7 @@ func dumpGenesis(ctx *cli.Context) error {
}
func importChain(ctx *cli.Context) error {
if len(ctx.Args()) < 1 {
if len(ctx.Args()) < 2 {
utils.Fatalf("This command requires an argument.")
}
// Start metrics export if enabled
@ -308,13 +308,14 @@ func importChain(ctx *cli.Context) error {
var importErr error
if len(ctx.Args()) == 1 {
// ArgsUsage: "<filename> (<filename 2> ... <filename N>) <genesisPath>",
if len(ctx.Args()) == 2 {
if err := utils.ImportChain(chain, ctx.Args().First()); err != nil {
importErr = err
log.Error("Import error", "err", err)
}
} else {
for _, arg := range ctx.Args() {
for _, arg := range ctx.Args()[:len(ctx.Args())-1] {
if err := utils.ImportChain(chain, arg); err != nil {
importErr = err
log.Error("Import error", "file", arg, "err", err)