MCPcopy Index your code
hub / github.com/docker/cli / SetPluginConfig

Method SetPluginConfig

cli/config/configfile/file.go:455–472  ·  view source on GitHub ↗

SetPluginConfig sets the option to the given value for the given plugin. Passing a value of "" will remove the option. If removing the final config item for a given plugin then also cleans up the overall plugin entry.

(pluginname, option, value string)

Source from the content-addressed store, hash-verified

453// the final config item for a given plugin then also cleans up the
454// overall plugin entry.
455func (c *ConfigFile) SetPluginConfig(pluginname, option, value string) {
456 if c.Plugins == nil {
457 c.Plugins = make(map[string]map[string]string)
458 }
459 pluginConfig, ok := c.Plugins[pluginname]
460 if !ok {
461 pluginConfig = make(map[string]string)
462 c.Plugins[pluginname] = pluginConfig
463 }
464 if value != "" {
465 pluginConfig[option] = value
466 } else {
467 delete(pluginConfig, option)
468 }
469 if len(pluginConfig) == 0 {
470 delete(c.Plugins, pluginname)
471 }
472}

Callers 3

mainFunction · 0.80
TestPluginConfigFunction · 0.80
TestConfigFunction · 0.80

Calls

no outgoing calls

Tested by 2

TestPluginConfigFunction · 0.64
TestConfigFunction · 0.64