|
|
|
|
@ -12,24 +12,22 @@ fn main() -> std::io::Result<()> {
|
|
|
|
|
let board_dir = format!("{}/{}", output_dir, json_data["name"].as_str().unwrap());
|
|
|
|
|
fs::create_dir(&board_dir)?;
|
|
|
|
|
|
|
|
|
|
if let Value::Array(lists) = &json_data["lists"]{
|
|
|
|
|
if let Value::Array(cards) = &json_data["cards"]{
|
|
|
|
|
for list in lists {
|
|
|
|
|
let list_dir = format!("{}/{}", board_dir, list["name"].as_str().unwrap());
|
|
|
|
|
fs::create_dir(&list_dir)?;
|
|
|
|
|
for card in cards {
|
|
|
|
|
if card["idList"] == list["id"]{
|
|
|
|
|
let file_path = format!("{}/{}.md", list_dir, card["name"].as_str().unwrap());
|
|
|
|
|
let mut file = fs::File::create(&file_path)?;
|
|
|
|
|
let header_text = format!("# {}\n\n", card["name"].as_str().unwrap());
|
|
|
|
|
file.write_all(header_text.as_bytes())?;
|
|
|
|
|
let checklists = json_data["checklists"].as_array().unwrap();
|
|
|
|
|
for checklist in checklists {
|
|
|
|
|
if checklist["idCard"] == card["id"]{
|
|
|
|
|
let checklist_title = format!("## {}\n\n", checklist["name"].as_str().unwrap());
|
|
|
|
|
file.write_all(checklist_title.as_bytes())?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
let lists = json_data["lists"].as_array().unwrap();
|
|
|
|
|
let cards = json_data["cards"].as_array().unwrap();
|
|
|
|
|
let checklists = json_data["checklists"].as_array().unwrap();
|
|
|
|
|
for list in lists {
|
|
|
|
|
let list_dir = format!("{}/{}", board_dir, list["name"].as_str().unwrap());
|
|
|
|
|
fs::create_dir(&list_dir)?;
|
|
|
|
|
for card in cards {
|
|
|
|
|
if card["idList"] == list["id"]{
|
|
|
|
|
let file_path = format!("{}/{}.md", list_dir, card["name"].as_str().unwrap());
|
|
|
|
|
let mut file = fs::File::create(&file_path)?;
|
|
|
|
|
let header_text = format!("# {}\n\n", card["name"].as_str().unwrap());
|
|
|
|
|
file.write_all(header_text.as_bytes())?;
|
|
|
|
|
for checklist in checklists {
|
|
|
|
|
if checklist["idCard"] == card["id"]{
|
|
|
|
|
let checklist_title = format!("## {}\n\n", checklist["name"].as_str().unwrap());
|
|
|
|
|
file.write_all(checklist_title.as_bytes())?;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|