From e9dfb0d7682dfbf30b33dc780377ab618c52e750 Mon Sep 17 00:00:00 2001 From: Emile Date: Thu, 3 Feb 2022 21:54:49 +0100 Subject: show_files directive --- src/main.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src') diff --git a/src/main.rs b/src/main.rs index 56a3f7f..9085649 100644 --- a/src/main.rs +++ b/src/main.rs @@ -272,6 +272,7 @@ fn write_same_level(file: &mut File, in_path: &Path, raw_path: &Path) let mut files: Vec = Vec::new(); let mut vertical: bool = false; + let mut show_files: bool = false; for entry in fs::read_dir(search_path)? { let path = &entry?.path(); @@ -285,6 +286,9 @@ fn write_same_level(file: &mut File, in_path: &Path, raw_path: &Path) if path.file_name().unwrap() == "vertical" { vertical = true; } + if path.file_name().unwrap() == "show_files" { + show_files = true; + } println!("\t\t\t{:?}", path); } } @@ -323,6 +327,36 @@ fn write_same_level(file: &mut File, in_path: &Path, raw_path: &Path) file.write_all(format!(r#" "#).as_bytes())?; + if files.len() >= 1 && show_files == true { + file.write_all(format!(r#"
+ "#).as_bytes())?; + } + + Ok(()) } -- cgit 1.4.1