GetFirstIntArgument returns the value of the first uint64 argument
(ctx *cli.Context)
| 23 | |
| 24 | // GetFirstIntArgument returns the value of the first uint64 argument |
| 25 | func GetFirstIntArgument(ctx *cli.Context) int64 { |
| 26 | if ctx.NArg() != 1 { |
| 27 | log.Fatal("Invalid length of arguments", "want", 1, "got", len(ctx.Args())) |
| 28 | } |
| 29 | |
| 30 | arg := ctx.Args().Get(0) |
| 31 | v, err := strconv.Atoi(arg) |
| 32 | if err != nil { |
| 33 | log.Fatal("Failed to parse value", "value", arg, "err", err) |
| 34 | } |
| 35 | |
| 36 | return int64(v) |
| 37 | } |
| 38 | |
| 39 | func GetFirstBoolArgument(ctx *cli.Context) bool { |
| 40 | if ctx.NArg() != 1 { |