refactor: Code-Qualität und Usability verbessern
- Ungenutzte Dependencies entfernt (itertools, thiserror) - 560 Build-Artefakte (target/) aus Git-Tracking entfernt - NO_COLOR Umgebungsvariable unterstützen (https://no-color.org/) - if let Ok/Err durch idiomatisches match ersetzt - Fehlermeldung bei Aufruf ohne Pfade hinzugefügt - Sequence::default() zu Sequence::standard() umbenannt um Verwechslung mit dem Rust Default-Trait zu vermeiden Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b08ff38a49
commit
de9bb4fd03
563 changed files with 26 additions and 1600 deletions
23
src/main.rs
23
src/main.rs
|
|
@ -42,9 +42,11 @@ struct RenameOperation {
|
|||
new_path: PathBuf,
|
||||
}
|
||||
|
||||
/// Prüft ob farbige Ausgabe aktiviert sein soll
|
||||
/// Prüft ob farbige Ausgabe aktiviert sein soll.
|
||||
/// Respektiert --no-color Flag, NO_COLOR Umgebungsvariable (https://no-color.org/)
|
||||
/// und ob stdout ein Terminal ist.
|
||||
fn should_use_color(no_color_flag: bool) -> bool {
|
||||
!no_color_flag && std::io::stdout().is_terminal()
|
||||
!no_color_flag && std::env::var_os("NO_COLOR").is_none() && std::io::stdout().is_terminal()
|
||||
}
|
||||
|
||||
/// Startpunkt des Programms
|
||||
|
|
@ -75,7 +77,7 @@ fn main() -> Result<()> {
|
|||
)
|
||||
})?
|
||||
} else {
|
||||
Sequence::default()
|
||||
Sequence::standard()
|
||||
};
|
||||
|
||||
if args.verbose {
|
||||
|
|
@ -116,6 +118,12 @@ fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
// Prüfe ob Pfade angegeben wurden
|
||||
if args.paths.is_empty() {
|
||||
eprintln!("Keine Pfade angegeben. Nutze 'ntu --help' für Hilfe.");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
// Für alle angegebenen Pfade
|
||||
for path in &args.paths {
|
||||
// Alle Einträge sammeln, damit zuerst die tiefsten umbenannt werden
|
||||
|
|
@ -140,13 +148,12 @@ fn main() -> Result<()> {
|
|||
.into_iter()
|
||||
.filter_entry(|e| !is_excluded(e, &exclude_patterns))
|
||||
{
|
||||
if let Ok(entry) = entry_result {
|
||||
entries.push(entry);
|
||||
} else if let Err(e) = entry_result {
|
||||
error!(
|
||||
match entry_result {
|
||||
Ok(entry) => entries.push(entry),
|
||||
Err(e) => error!(
|
||||
"{}",
|
||||
format!("Fehler beim Durchlaufen von {}: {}", path.display(), e).red()
|
||||
);
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue