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

Method Unset

internal/editorconfig/json_tool.go:120–141  ·  view source on GitHub ↗
(scope Scope, keyPath string)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

PathForMethod · 0.95
ParseFunction · 0.85
loadJSONFunction · 0.85
UnsetFunction · 0.85
writeJSONFunction · 0.70

Tested by

no test coverage detected