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

Function GetFirstBoolArgument

tools/contract-admin/utils/utils.go:39–54  ·  view source on GitHub ↗
(ctx *cli.Context)

Source from the content-addressed store, hash-verified

37}
38
39func GetFirstBoolArgument(ctx *cli.Context) bool {
40 if ctx.NArg() != 1 {
41 log.Fatal("Invalid length of arguments", "want", 1, "got", ctx.NArg())
42 }
43
44 arg := ctx.Args().Get(0)
45 if arg == "true" || arg == "True" || arg == "TRUE" {
46 return true
47 } else if arg == "false" || arg == "False" || arg == "FALSE" {
48 return false
49 } else {
50 log.Fatal("Invalid argument", "want", "bool", "got", arg)
51 }
52
53 return false
54}
55
56// GetFirstStringArgument returns the value of the first string argument
57func GetFirstStringArgument(ctx *cli.Context) string {

Callers

nothing calls this directly

Calls 2

FatalMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected