MCPcopy Create free account
hub / github.com/Wulf/create-rust-app / prepend

Function prepend

crates/create-rust-app_cli/src/utils/fs.rs:98–111  ·  view source on GitHub ↗
(file_path: &str, content: &str)

Source from the content-addressed store, hash-verified

96}
97
98pub fn prepend(file_path: &str, content: &str) -> Result<()> {
99 modify_file_msg(&format!("{:#?}", &file_path));
100
101 let (file_path, file_contents) = read(file_path)?;
102
103 let mut new_content = String::new();
104 new_content.push_str(content);
105 new_content.push('\n');
106 new_content.push_str(file_contents.as_str());
107
108 std::fs::write(file_path, new_content)?;
109
110 Ok(())
111}
112
113/*
114/// Try to create files via the template-* folders for plugins

Callers 2

installMethod · 0.85
installMethod · 0.85

Calls 2

modify_file_msgFunction · 0.85
readFunction · 0.85

Tested by

no test coverage detected