Compare commits
2 Commits
f22845d7c8
...
f80f6ac707
Author | SHA1 | Date | |
---|---|---|---|
f80f6ac707 | |||
987e4b477f |
14
.gitignore
vendored
14
.gitignore
vendored
@ -19,3 +19,17 @@ desktop.ini
|
||||
# Releases (realAscot)
|
||||
releases/**
|
||||
bin/**
|
||||
|
||||
# Misc
|
||||
*zip
|
||||
*.tar.gz
|
||||
*.tar.xz
|
||||
*.tar.bz2
|
||||
*.tar.lz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -458,7 +458,7 @@ checksum = "bfb942dfe1d8e29a7ee7fcbde5bd2b9a25fb89aa70caea2eba3bee836ff41076"
|
||||
|
||||
[[package]]
|
||||
name = "treescanner"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
dependencies = [
|
||||
"clap",
|
||||
"dirs",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "treescanner"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
edition = "2024"
|
||||
|
||||
[package.metadata.winres]
|
||||
|
@ -28,8 +28,9 @@ Der original treeScanner in Python ist unter <https://github.com/realAscot/treeS
|
||||
- [🔍 Ort](#-ort)
|
||||
- [📘 Format](#-format)
|
||||
- [📝 Format (.toml)](#-format-toml)
|
||||
- [Build](#build)
|
||||
- [Lizenz](#lizenz)
|
||||
- [Eingesetzte Libraries (MIT-kompatibel):](#eingesetzte-libraries-mit-kompatibel)
|
||||
- [Eingesetzte Libraries (MIT-kompatibel)](#eingesetzte-libraries-mit-kompatibel)
|
||||
- [💬 Kontakt](#-kontakt)
|
||||
|
||||
---
|
||||
@ -180,11 +181,15 @@ align_comments = false
|
||||
|
||||
---
|
||||
|
||||
## Build
|
||||
|
||||
---
|
||||
|
||||
## Lizenz
|
||||
|
||||
Dieses Projekt steht unter der [MIT-Lizenz](./LICENSE).
|
||||
|
||||
### Eingesetzte Libraries (MIT-kompatibel):
|
||||
### Eingesetzte Libraries (MIT-kompatibel)
|
||||
|
||||
| Crate | Lizenz |
|
||||
|-----------------|------------|
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <winver.h>
|
||||
|
||||
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
|
||||
|
@ -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 { "└── " };
|
||||
|
@ -42,7 +42,7 @@ pub struct CliArgs {
|
||||
pub output: Option<PathBuf>,
|
||||
|
||||
/// Nur in Konsole anzeigen, keine Ausgabedatei speichern
|
||||
#[arg(long)]
|
||||
#[arg(short = 'i', long)]
|
||||
pub viewonly: bool,
|
||||
|
||||
/// Debug-Modus aktivieren
|
||||
|
22
src/main.rs
22
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<String> = 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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user