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

Function interactiveUninstall

internal/cli/management.go:2211–2251  ·  view source on GitHub ↗

interactiveUninstall lists installed items and lets the user pick which to remove.

(kind entities.Kind, apps []string, out io.Writer)

Source from the content-addressed store, hash-verified

2209
2210// interactiveUninstall lists installed items and lets the user pick which to remove.
2211func interactiveUninstall(kind entities.Kind, apps []string, out io.Writer) error {
2212 for _, app := range apps {
2213 appPaths := entities.AppPathsFor(kind)
2214 dest, ok := appPaths[app]
2215 if !ok {
2216 continue
2217 }
2218 resolved := expandPath(dest)
2219
2220 if kind == entities.KindPrompt || kind == entities.KindInstruction {
2221 fmt.Fprintf(out, " %s — prompt uninstall not supported interactively\n", app)
2222 continue
2223 }
2224
2225 entries, err := os.ReadDir(resolved)
2226 if err != nil {
2227 continue
2228 }
2229 var items []multiSelectItem
2230 for _, e := range entries {
2231 if !e.IsDir() {
2232 continue
2233 }
2234 items = append(items, multiSelectItem{label: e.Name()})
2235 }
2236 if len(items) == 0 {
2237 fmt.Fprintf(out, "No %ss installed in %s\n", kind, app)
2238 continue
2239 }
2240
2241 title := fmt.Sprintf("Select %s(s) to uninstall from %s:", kind, app)
2242 selected, err := runMultiSelect(title, items)
2243 if err != nil {
2244 return err
2245 }
2246 for _, name := range selected {
2247 uninstallOneFromApp(kind, app, name, out)
2248 }
2249 }
2250 return nil
2251}
2252
2253func readStdinIfPiped(in io.Reader) (string, error) {
2254 if file, ok := in.(*os.File); ok {

Callers 1

entityUninstallCommandFunction · 0.85

Calls 5

AppPathsForFunction · 0.92
expandPathFunction · 0.85
runMultiSelectFunction · 0.85
uninstallOneFromAppFunction · 0.85
NameMethod · 0.65

Tested by

no test coverage detected