isAlreadyInstalled checks whether the named entity is already installed for the given app.
(name string, kind entities.Kind, app string)
| 2074 | |
| 2075 | // isAlreadyInstalled checks whether the named entity is already installed for the given app. |
| 2076 | func isAlreadyInstalled(name string, kind entities.Kind, app string) bool { |
| 2077 | apps := entities.AppPathsFor(kind) |
| 2078 | dest, ok := apps[app] |
| 2079 | if !ok { |
| 2080 | return false |
| 2081 | } |
| 2082 | resolved := expandPath(dest) |
| 2083 | switch kind { |
| 2084 | case entities.KindPrompt, entities.KindInstruction: |
| 2085 | _, err := os.Stat(resolved) |
| 2086 | return err == nil |
| 2087 | default: |
| 2088 | _, err := os.Stat(filepath.Join(resolved, name)) |
| 2089 | return err == nil |
| 2090 | } |
| 2091 | } |
| 2092 | |
| 2093 | // ============================================================================ |
| 2094 | // uninstall — remove from code agent(s) |
no test coverage detected