MCPcopy Create free account
hub / github.com/CPChain/chain / GetFirstIntArgument

Function GetFirstIntArgument

tools/contract-admin/utils/utils.go:25–37  ·  view source on GitHub ↗

GetFirstIntArgument returns the value of the first uint64 argument

(ctx *cli.Context)

Source from the content-addressed store, hash-verified

23
24// GetFirstIntArgument returns the value of the first uint64 argument
25func 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
39func GetFirstBoolArgument(ctx *cli.Context) bool {
40 if ctx.NArg() != 1 {

Callers

nothing calls this directly

Calls 2

FatalMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected