dotfiles_rs/readme_template.rs
1use log::info;
2use std::fs;
3
4const README_TEXT: &str = "# Dotfiles\n
5This is a repo to save all the config files
6from backing up with [dotfiles-rs](https://github.com/wckdouglas/dotfiles-rs) \n\n
7:warning: this repo should be private!!
8";
9
10/// Writing template readme to a file
11///
12/// # Args
13/// - `readme_fn`: file path to the output readme markdown file
14///
15/// # Return
16/// - return code or error
17///
18/// # Example
19/// ```
20/// use dotfiles_rs::readme_template::write_template_readme;
21///
22/// let filename = "test_readme.md";
23/// write_template_readme(filename.to_string());
24/// ```
25pub fn write_template_readme(readme_fn: String) -> Result<u8, String> {
26 fs::write(&readme_fn, README_TEXT).map_err(|e| e.to_string())?;
27 info!("Written {}", readme_fn);
28 Ok(0)
29}