diff --git a/.gitignore b/.gitignore index f578210..d4827f5 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,17 @@ desktop.ini # Releases (realAscot) releases/** bin/** + +# Misc +*zip +*.tar.gz +*.tar.xz +*.tar.bz2 +*.tar.lz + + + + + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index ed86fcc..cd5b8e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog treeScanner (Rust) +- **2025-05-24 - v1.0.1** + - **Bugfix:** + - [x] Parameter werden nun richtig geparst, auch `-x ./fu/,./bla` statt bisher nur `-x fu,bla` + +--- + - **2025-05-17 - v1.0.0** - **GeΓ€ndert:** - [x] Komplette Neuumsetzung des TreeScanner-Tools in Rust diff --git a/Cargo.lock b/Cargo.lock index 4a27a14..2d48aac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -458,7 +458,7 @@ checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076" [[package]] name = "treescanner" -version = "1.0.0" +version = "1.0.1" dependencies = [ "clap", "dirs", diff --git a/Cargo.toml b/Cargo.toml index 04621a7..409ca0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "treescanner" -version = "1.0.0" +version = "1.0.1" edition = "2024" [package.metadata.winres] diff --git a/README.md b/README.md index 341ba32..9cd7c80 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,9 @@ Der original treeScanner in Python ist unter VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,0 + FILEVERSION 1,0,1,0 PRODUCTVERSION 1,0,0,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L @@ -17,11 +17,11 @@ BEGIN BEGIN VALUE "CompanyName", "ionivation.com" VALUE "FileDescription", "CLI Verzeichnisscanner" - VALUE "FileVersion", "1.0.0.0" + VALUE "FileVersion", "1.0.1.0" VALUE "InternalName", "treescanner" VALUE "OriginalFilename", "treescanner.exe" VALUE "ProductName", "CLI Treescanner" - VALUE "ProductVersion", "1.0.0" + VALUE "ProductVersion", "1.0.1" VALUE "LegalCopyright", "(C) 2025 Adam Skotarczak" END END diff --git a/src/app/treebuilder.rs b/src/app/treebuilder.rs index 9004b9d..dc675fc 100644 --- a/src/app/treebuilder.rs +++ b/src/app/treebuilder.rs @@ -54,17 +54,26 @@ impl TreeBuilder { let mut folders = vec![]; let mut files = vec![]; + for entry in entries { + let path = entry.path(); let file_name = entry.file_name().into_string().unwrap_or_default(); - if entry.path().is_dir() { - if !self.config.ignored_dirs.contains(&file_name) { - folders.push((file_name, entry.path())); + + if path.is_dir() { + + if let Some(dir_name) = path.file_name().and_then(|s| s.to_str()) { + if self.config.ignored_dirs.iter().any(|ex| ex == dir_name) { + continue; + } } + + folders.push((file_name, path)); } else { files.push(file_name); } } + for (idx, (name, path)) in folders.iter().enumerate() { self.folder_count += 1; let connector = if idx < folders.len() - 1 || !files.is_empty() { "β”œβ”€β”€ " } else { "└── " }; diff --git a/src/config/args.rs b/src/config/args.rs index 14e023c..dc9ec0d 100644 --- a/src/config/args.rs +++ b/src/config/args.rs @@ -42,7 +42,7 @@ pub struct CliArgs { pub output: Option, /// Nur in Konsole anzeigen, keine Ausgabedatei speichern - #[arg(long)] + #[arg(short = 'i', long)] pub viewonly: bool, /// Debug-Modus aktivieren diff --git a/src/main.rs b/src/main.rs index 880d265..ca74172 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,15 @@ fn view_timer(timer: &Instant) { println!("\n⏱️ Gesamtlaufzeit des Scans: {:.2?}", timer.elapsed()); } +// Hilfsfunktion zur Pfad-Normalisierung +fn normalize_ignore_entry(s: &str) -> String { + s.trim_start_matches("./") + .trim_start_matches(".\\") + .trim_end_matches('/') + .trim_end_matches('\\') + .to_string() +} + fn main() { init_logger(); let args = CliArgs::parse(); @@ -34,6 +43,12 @@ fn main() { } } + let ignored_dirs: Vec = match (!args.ignore.is_empty(), file_config.ignore) { + (true, _) => args.ignore.iter().map(|s| normalize_ignore_entry(s)).collect(), + (false, Some(set)) => set.into_iter().map(|s| normalize_ignore_entry(&s)).collect(), + (false, None) => vec![], + }; + let config = TreeBuilderConfig { root_path: args.root_path.clone(), max_depth: args.max_depth.or(file_config.max_depth), @@ -42,12 +57,7 @@ fn main() { } else { file_config.max_files_per_dir.unwrap_or(100) }, - // Ignorierte Verzeichnisse: CLI hat Vorrang, dann Config, sonst leer - ignored_dirs: match (!args.ignore.is_empty(), file_config.ignore) { - (true, _) => args.ignore, - (false, Some(set)) => set.into_iter().collect(), - (false, None) => vec![], - }, + ignored_dirs, folder_icon: "πŸ“".to_string(), file_icon: "πŸ“„".to_string(), align_comments: args.align_comments,