InstallInstruction writes the instruction entity's content to the target path determined by app and level. For user-level installs the path is resolved under the user's home directory. For project-level installs the projectDir must point to an existing directory; the path is resolved relative to i
(entity Entity, app string, level InstallLevel, projectDir string)
| 338 | // projectDir must point to an existing directory; the path is resolved |
| 339 | // relative to it. |
| 340 | func InstallInstruction(entity Entity, app string, level InstallLevel, projectDir string) (string, error) { |
| 341 | dest, err := InstructionPath(app, level, projectDir) |
| 342 | if err != nil { |
| 343 | return "", err |
| 344 | } |
| 345 | if err := writeFile(dest, []byte(entity.Content), 0o600); err != nil { |
| 346 | return "", err |
| 347 | } |
| 348 | return dest, nil |
| 349 | } |
| 350 | |
| 351 | // UninstallInstruction resolves the instruction file for the given app and |
| 352 | // level and reports whether it exists. Instruction files are app-wide guidance |