MCPcopy
hub / github.com/digitalocean/doctl / IsSet

Method IsSet

doit.go:347–361  ·  view source on GitHub ↗

IsSet checks if a config is set

(key string)

Source from the content-addressed store, hash-verified

345
346// IsSet checks if a config is set
347func (c *LiveConfig) IsSet(key string) bool {
348 matches := regexp.MustCompile("\b*--([a-z-_]+)").FindAllStringSubmatch(strings.Join(os.Args, " "), -1)
349 if len(matches) == 0 {
350 return false
351 }
352
353 if len(c.cliArgs) == 0 {
354 args := make(map[string]bool)
355 for _, match := range matches {
356 args[match[1]] = true
357 }
358 c.cliArgs = args
359 }
360 return c.cliArgs[key]
361}
362
363// GetString returns a config value as a string.
364func (c *LiveConfig) GetString(ns, key string) (string, error) {

Callers 4

GetBoolPtrMethod · 0.95
GetIntPtrMethod · 0.95
GetStringMapStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected