| 124 | */ |
| 125 | |
| 126 | pub fn append(file_path: &str, content: &str) -> Result<()> { |
| 127 | modify_file_msg(&format!("{:#?}", &file_path)); |
| 128 | |
| 129 | let (file_path, file_contents) = read(file_path)?; |
| 130 | |
| 131 | let mut new_content = String::new(); |
| 132 | new_content.push_str(file_contents.as_str()); |
| 133 | new_content.push('\n'); |
| 134 | new_content.push_str(content); |
| 135 | |
| 136 | std::fs::write(file_path, new_content)?; |
| 137 | |
| 138 | Ok(()) |
| 139 | } |
| 140 | |
| 141 | pub fn replace(file_path: &str, from: &str, to: &str) -> Result<()> { |
| 142 | modify_file_msg(&format!("{:#?}", &file_path)); |