| 116 | } |
| 117 | |
| 118 | func (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 | |
| 141 | func writeYAML(path string, data map[string]any) error { |
| 142 | if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil { |