From 4d1aecb12a77a0a27fededbfcaac545cdcba64c7 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Mon, 25 Nov 2024 11:01:15 +0800 Subject: [PATCH] cmd/XDC: fix some cli parsing issues (#25234) --- cmd/XDC/consolecmd.go | 5 ++++- internal/flags/helpers.go | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/XDC/consolecmd.go b/cmd/XDC/consolecmd.go index e85ce460e38e..1ae712748549 100644 --- a/cmd/XDC/consolecmd.go +++ b/cmd/XDC/consolecmd.go @@ -111,7 +111,10 @@ func localConsole(ctx *cli.Context) error { // remoteConsole will connect to a remote XDC instance, attaching a JavaScript // console to it. func remoteConsole(ctx *cli.Context) error { - // Attach to a remotely running XDC instance and start the JavaScript console + if ctx.Args().Len() > 1 { + utils.Fatalf("invalid command-line: too many arguments") + } + endpoint := ctx.Args().First() if endpoint == "" { path := node.DefaultDataDir() diff --git a/internal/flags/helpers.go b/internal/flags/helpers.go index e121aa544c40..4642b82c45a7 100644 --- a/internal/flags/helpers.go +++ b/internal/flags/helpers.go @@ -70,6 +70,10 @@ func MigrateGlobalFlags(ctx *cli.Context) { // This iterates over all commands and wraps their action function. iterate(ctx.App.Commands, func(cmd *cli.Command) { + if cmd.Action == nil { + return + } + action := cmd.Action cmd.Action = func(ctx *cli.Context) error { doMigrateFlags(ctx)