(path: &Path)
| 102 | |
| 103 | let existing = if profile_path.exists() { |
| 104 | fs::read_to_string(profile_path) |
| 105 | .map_err(|err| format!("failed to read {}: {err}", profile_path.display()))? |
| 106 | } else { |
| 107 | String::new() |
| 108 | }; |
| 109 | |
| 110 | let updated = replace_or_append_snippet(&existing, snippet)?; |
| 111 | fs::write(profile_path, updated) |