MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / Unset

Method Unset

internal/editorconfig/yaml_tool.go:118–139  ·  view source on GitHub ↗
(scope Scope, keyPath string)

Source from the content-addressed store, hash-verified

116}
117
118func (c *yamlToolConfig) Unset(scope Scope, keyPath string) (bool, string, error) {
119 parts, err := Parse(keyPath)
120 if err != nil {
121 return false, "", err
122 }
123 path := c.PathFor(scope)
124 if path == "" {
125 return false, "", fmt.Errorf("editorconfig: %s scope %s unsupported", c.spec.name, scope)
126 }
127 data, _, err := loadYAML(path)
128 if err != nil {
129 return false, "", err
130 }
131 found := Unset(data, parts)
132 if !found {
133 return false, path, nil
134 }
135 if err := writeYAML(path, data); err != nil {
136 return false, "", err
137 }
138 return true, path, nil
139}
140
141func writeYAML(path string, data map[string]any) error {
142 if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {

Callers

nothing calls this directly

Calls 5

PathForMethod · 0.95
ParseFunction · 0.85
loadYAMLFunction · 0.85
UnsetFunction · 0.85
writeYAMLFunction · 0.85

Tested by

no test coverage detected