MCPcopy
hub / github.com/CodisLabs/codis / Argument

Function Argument

pkg/utils/args.go:12–24  ·  view source on GitHub ↗
(d map[string]interface{}, name string)

Source from the content-addressed store, hash-verified

10)
11
12func Argument(d map[string]interface{}, name string) (string, bool) {
13 if d[name] != nil {
14 if s, ok := d[name].(string); ok {
15 if s != "" {
16 return s, true
17 }
18 log.Panicf("option %s requires an argument", name)
19 } else {
20 log.Panicf("option %s isn't a valid string", name)
21 }
22 }
23 return "", false
24}
25
26func ArgumentMust(d map[string]interface{}, name string) string {
27 s, ok := Argument(d, name)

Callers 2

ArgumentMustFunction · 0.85
ArgumentIntegerFunction · 0.85

Calls 1

PanicfMethod · 0.80

Tested by

no test coverage detected