From e9ad3832c1c61b4e481842fa913ece8969291cea Mon Sep 17 00:00:00 2001 From: Matthew Huntington Date: Sun, 23 Apr 2023 20:21:10 -0400 Subject: [PATCH] write files with headers --- src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0d96eb5..50810cc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use std::fs; use serde_json::Value; -//use std::io::Write; +use std::io::Write; fn main() -> std::io::Result<()> { let json_string = fs::read_to_string("boards/coding.json")?; @@ -21,9 +21,9 @@ fn main() -> std::io::Result<()> { if card["idList"] == list["id"]{ let file_path = format!("{}/{}.md", list_dir, card["name"].as_str().unwrap()); println!("{}", file_path); - //let mut _file = fs::File::create(&file_path)?; - //let header_text = format!("# {}", card["name"]); - //file.write_all(header_text.as_bytes())?; + let mut file = fs::File::create(&file_path)?; + let header_text = format!("# {}\n", card["name"].as_str().unwrap()); + file.write_all(header_text.as_bytes())?; } } }