Implementiere farbige Terminal-Ausgabe

- Fügt colored Crate hinzu für bessere visuelle Unterscheidung
- Grün: erfolgreiche Umbenennungen
- Gelb: Dry-run Modus
- Rot: Fehlermeldungen
- Cyan/Bold: Statistik-Zusammenfassung
- Neues --no-color Flag zum Deaktivieren
- Automatische Farberkennung via is_terminal()
- Behebt ungenutzten warn Import
- Aktualisiert Integration-Tests auf neues cargo_bin! Makro

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
jamulix 2026-02-10 13:39:30 +01:00
commit a348487f6a
5 changed files with 75 additions and 27 deletions

View file

@ -1,5 +1,5 @@
use assert_cmd::assert::OutputAssertExt;
use assert_cmd::cargo::CommandCargoExt;
use assert_cmd::cargo::cargo_bin;
use predicates::prelude::*;
use std::fs;
use std::process::Command;
@ -7,7 +7,7 @@ use tempfile::TempDir;
#[test]
fn test_help_flag() {
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg("--help");
cmd.assert()
.success()
@ -16,7 +16,7 @@ fn test_help_flag() {
#[test]
fn test_version_flag() {
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg("--version");
cmd.assert()
.success()
@ -29,7 +29,7 @@ fn test_dry_run_no_changes() {
let file_path = temp_dir.path().join("test file.txt");
fs::write(&file_path, "test content").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg("--dry-run").arg(temp_dir.path());
cmd.assert().success();
@ -44,7 +44,7 @@ fn test_actual_rename() {
let file_path = temp_dir.path().join("test file.txt");
fs::write(&file_path, "test content").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -59,7 +59,7 @@ fn test_hidden_files_preserved() {
let file_path = temp_dir.path().join(".gitignore");
fs::write(&file_path, "*.tmp").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -73,7 +73,7 @@ fn test_hidden_file_with_spaces() {
let file_path = temp_dir.path().join(".my config");
fs::write(&file_path, "config content").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -88,7 +88,7 @@ fn test_umlaut_conversion() {
let file_path = temp_dir.path().join("Müller.txt");
fs::write(&file_path, "test").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -103,7 +103,7 @@ fn test_double_extension() {
let file_path = temp_dir.path().join("my archive.tar.gz");
fs::write(&file_path, "archive").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -120,7 +120,7 @@ fn test_exclude_pattern() {
fs::write(&file1, "test1").unwrap();
fs::write(&file2, "test2").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg("--exclude")
.arg("*.tmp")
.arg(temp_dir.path());
@ -138,7 +138,7 @@ fn test_quiet_mode() {
let file_path = temp_dir.path().join("test file.txt");
fs::write(&file_path, "test").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg("--quiet").arg(temp_dir.path());
cmd.assert()
.success()
@ -154,7 +154,7 @@ fn test_multiple_paths() {
fs::write(&file1, "test1").unwrap();
fs::write(&file2, "test2").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir1.path()).arg(temp_dir2.path());
cmd.assert().success();
@ -169,7 +169,7 @@ fn test_parentheses_removed() {
let file_path = temp_dir.path().join("Document (1).txt");
fs::write(&file_path, "test").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();
@ -184,7 +184,7 @@ fn test_special_identifiers_preserved() {
let file_path = temp_dir.path().join("C++ Guide.pdf");
fs::write(&file_path, "test").unwrap();
let mut cmd = Command::cargo_bin("ntu").unwrap();
let mut cmd = Command::new(cargo_bin!("ntu"));
cmd.arg(temp_dir.path());
cmd.assert().success();