forked from cerc-io/plugeth
cmd/*: refactor get flag value (#24761)
This commit is contained in:
@@ -34,18 +34,20 @@ import (
|
||||
"gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
var fileFlag = cli.StringFlag{Name: "file"}
|
||||
|
||||
var enrdumpCommand = cli.Command{
|
||||
Name: "enrdump",
|
||||
Usage: "Pretty-prints node records",
|
||||
Action: enrdump,
|
||||
Flags: []cli.Flag{
|
||||
cli.StringFlag{Name: "file"},
|
||||
fileFlag,
|
||||
},
|
||||
}
|
||||
|
||||
func enrdump(ctx *cli.Context) error {
|
||||
var source string
|
||||
if file := ctx.String("file"); file != "" {
|
||||
if file := ctx.String(fileFlag.Name); file != "" {
|
||||
if ctx.NArg() != 0 {
|
||||
return fmt.Errorf("can't dump record from command-line argument in -file mode")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user