cmd: use slices.Concat instead of GroupFlags

This commit is contained in:
Daniel Liu 2025-02-17 15:06:52 +08:00
parent 9b7d0c20e7
commit 2fb9e99ba3
3 changed files with 6 additions and 13 deletions

View file

@ -24,6 +24,7 @@ import (
"math/big"
"os"
"reflect"
"slices"
"strings"
"unicode"
@ -49,7 +50,7 @@ var (
Name: "dumpconfig",
Usage: "Show configuration values",
ArgsUsage: "",
Flags: utils.GroupFlags(nodeFlags, rpcFlags),
Flags: slices.Concat(nodeFlags, rpcFlags),
Description: `The dumpconfig command shows configuration values.`,
}

View file

@ -21,6 +21,7 @@ import (
"os"
"os/signal"
"path/filepath"
"slices"
"strings"
"syscall"
@ -38,7 +39,7 @@ var (
Action: localConsole,
Name: "console",
Usage: "Start an interactive JavaScript environment",
Flags: utils.GroupFlags(nodeFlags, rpcFlags, consoleFlags),
Flags: slices.Concat(nodeFlags, rpcFlags, consoleFlags),
Description: `
The XDC console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
@ -50,7 +51,7 @@ See https://github.com/XinFinOrg/XDPoSChain/wiki/JavaScript-Console.`,
Name: "attach",
Usage: "Start an interactive JavaScript environment (connect to node)",
ArgsUsage: "[endpoint]",
Flags: utils.GroupFlags([]cli.Flag{utils.DataDirFlag}, consoleFlags),
Flags: slices.Concat([]cli.Flag{utils.DataDirFlag}, consoleFlags),
Description: `
The XDC console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
@ -63,7 +64,7 @@ This command allows to open a console on a running XDC node.`,
Name: "js",
Usage: "Execute the specified JavaScript files",
ArgsUsage: "<jsfile> [jsfile...]",
Flags: utils.GroupFlags(nodeFlags, consoleFlags),
Flags: slices.Concat(nodeFlags, consoleFlags),
Description: `
The JavaScript VM exposes a node admin interface as well as the Ðapp
JavaScript API. See https://github.com/XinFinOrg/XDPoSChain/wiki/JavaScript-Console`,

View file

@ -816,15 +816,6 @@ var (
}
)
// GroupFlags combines the given flag slices together and returns the merged one.
func GroupFlags(groups ...[]cli.Flag) []cli.Flag {
var ret []cli.Flag
for _, group := range groups {
ret = append(ret, group...)
}
return ret
}
// MakeDataDir retrieves the currently requested data directory, terminating
// if none (or the empty string) is specified. If the node is starting a testnet,
// the a subdirectory of the specified datadir will be used.