(kind entities.Kind, app string, out io.Writer)
| 2171 | } |
| 2172 | |
| 2173 | func uninstallAllFromApp(kind entities.Kind, app string, out io.Writer) { |
| 2174 | appPaths := entities.AppPathsFor(kind) |
| 2175 | dest, ok := appPaths[app] |
| 2176 | if !ok { |
| 2177 | fmt.Fprintf(out, " %s does not support %ss\n", app, kind) |
| 2178 | return |
| 2179 | } |
| 2180 | resolved := expandPath(dest) |
| 2181 | |
| 2182 | if kind == entities.KindPrompt || kind == entities.KindInstruction { |
| 2183 | // Prompts are single files — don't remove the user's CLAUDE.md etc. |
| 2184 | fmt.Fprintf(out, " Skipping %s — prompt files are not bulk-removable\n", app) |
| 2185 | return |
| 2186 | } |
| 2187 | |
| 2188 | entries, err := os.ReadDir(resolved) |
| 2189 | if err != nil { |
| 2190 | fmt.Fprintf(out, " No %ss installed in %s\n", kind, app) |
| 2191 | return |
| 2192 | } |
| 2193 | |
| 2194 | removed := 0 |
| 2195 | for _, e := range entries { |
| 2196 | if !e.IsDir() { |
| 2197 | continue |
| 2198 | } |
| 2199 | target := filepath.Join(resolved, e.Name()) |
| 2200 | if err := os.RemoveAll(target); err != nil { |
| 2201 | fmt.Fprintf(out, " Error removing %s: %v\n", e.Name(), err) |
| 2202 | continue |
| 2203 | } |
| 2204 | fmt.Fprintf(out, " Removed %s from %s\n", e.Name(), app) |
| 2205 | removed++ |
| 2206 | } |
| 2207 | fmt.Fprintf(out, "\nRemoved %d %s(s) from %s\n", removed, kind, app) |
| 2208 | } |
| 2209 | |
| 2210 | // interactiveUninstall lists installed items and lets the user pick which to remove. |
| 2211 | func interactiveUninstall(kind entities.Kind, apps []string, out io.Writer) error { |
no test coverage detected