refactor: Binary von NameToUnix zu ntu umbenannt

- Binary heißt jetzt 'ntu' für kürzere CLI-Nutzung
- Package-Name bleibt 'NameToUnix' (für Repository/Crate)
- Alle Beispiele und Dokumentation in README.md angepasst
- CLAUDE.md mit neuen Build-Pfaden aktualisiert
- Cargo.toml: [[bin]] Sektion und deb assets angepasst

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
jamulix 2026-02-10 09:46:34 +01:00
commit 870c49297a
3 changed files with 40 additions and 30 deletions

View file

@ -18,7 +18,7 @@ cargo build
cargo build --release cargo build --release
# Binary liegt dann unter: # Binary liegt dann unter:
# target/release/NameToUnix # target/release/ntu
# Tests ausführen # Tests ausführen
cargo test cargo test
@ -45,12 +45,18 @@ cd test
# Vorschau (keine Änderungen): # Vorschau (keine Änderungen):
cargo run -- -n ./testverzeichnis cargo run -- -n ./testverzeichnis
# oder mit installierter Binary:
ntu -n ./testverzeichnis
# Mit Änderungen: # Mit Änderungen:
cargo run -- ./testverzeichnis cargo run -- ./testverzeichnis
# oder:
ntu ./testverzeichnis
# Mit Verbose-Ausgabe: # Mit Verbose-Ausgabe:
cargo run -- -v ./testverzeichnis cargo run -- -v ./testverzeichnis
# oder:
ntu -v ./testverzeichnis
``` ```
## Code-Architektur ## Code-Architektur

View file

@ -10,6 +10,10 @@ repository = "https://github.com/jamulix/NameToUnix"
keywords = ["filesystem", "rename", "sanitize", "cli"] keywords = ["filesystem", "rename", "sanitize", "cli"]
categories = ["command-line-utilities", "filesystem"] categories = ["command-line-utilities", "filesystem"]
[[bin]]
name = "ntu"
path = "src/main.rs"
[dependencies] [dependencies]
# Bereits verwendete Abhängigkeiten # Bereits verwendete Abhängigkeiten
clap = { version = "4.5.27", features = ["derive"] } clap = { version = "4.5.27", features = ["derive"] }
@ -57,7 +61,7 @@ depends = "$auto"
section = "utils" section = "utils"
priority = "optional" priority = "optional"
assets = [ assets = [
["target/release/NameToUnix", "usr/bin/", "755"], ["target/release/ntu", "usr/bin/", "755"],
["README.md", "usr/share/doc/NameToUnix/README", "644"], ["README.md", "usr/share/doc/NameToUnix/README", "644"],
] ]

View file

@ -41,22 +41,22 @@ Dies ist mein erstes Programm in Rust. (Bitte seid gnädig.)
## Installation ## Installation
Die ausführbare Datei wird unter `target/release/NameToUnix` erstellt. Du solltest sie mit 'sudo cp target/release/NameToUnix /usr/local/bin/' kopieren. Sie ist dann für alle User verfügbar. Denke daran, die Konfiguationsdatei (s. u.) ebenfalls zu kopieren. Sie kann für jeden User individuell angepasst werden, wenn sie im home-Verzeichnis des Users liegt. Die ausführbare Datei wird unter `target/release/ntu` erstellt. Du solltest sie mit 'sudo cp target/release/ntu /usr/local/bin/' kopieren. Sie ist dann für alle User verfügbar. Denke daran, die Konfiguationsdatei (s. u.) ebenfalls zu kopieren. Sie kann für jeden User individuell angepasst werden, wenn sie im home-Verzeichnis des Users liegt.
The executable file is created under `target/release/NameToUnix`. You should copy it with 'sudo cp target/release/NameToUnix /usr/local/bin/'. It is then available for all users. Remember to copy the configuration file (see below) as well. It can be customized for each user individually if it is located in the user's home directory. The executable file is created under `target/release/ntu`. You should copy it with 'sudo cp target/release/ntu /usr/local/bin/'. It is then available for all users. Remember to copy the configuration file (see below) as well. It can be customized for each user individually if it is located in the user's home directory.
```bash ```bash
git clone https://github.com/jamulix/NameToUnix.git # Download repository git clone https://github.com/jamulix/NameToUnix.git # Download repository
cd NameToUnix # Change to download directory cd NameToUnix # Change to download directory
cargo build --release # Build binary cargo build --release # Build binary
sudo cp target/release/NameToUnix /usr/local/bin/ # copy binary to local bin directory sudo cp target/release/ntu /usr/local/bin/ # copy binary to local bin directory
# Globale Einstellungen / Global Settings # Globale Einstellungen / Global Settings
sudo mkdir -p /etc/NameToUnix/ # Create global config directory for NameToUnix in /etc sudo mkdir -p /etc/NameToUnix/ # Create global config directory for NameToUnix in /etc
sudo cp .NameToUnix.conf /etc/NameToUnix/config.toml # Copy config file to this global directory sudo cp .NameToUnix.conf /etc/NameToUnix/config.toml # Copy config file to this global directory
# Lokale Einstellungen / Local settings # Lokale Einstellungen / Local settings
mkdir -p ~/.config/NameToUnix/ # Create a personal config directory for NameToUnix mkdir -p ~/.config/NameToUnix/ # Create a personal config directory for NameToUnix
cp .NameToUnix.conf ~/.config/NameToUnix/config.toml # Copy config file to this personal directory cp .NameToUnix.conf ~/.config/NameToUnix/config.toml # Copy config file to this personal directory
``` ```
@ -64,44 +64,44 @@ cp .NameToUnix.conf ~/.config/NameToUnix/config.toml # Copy config file to
```bash ```bash
# Basic usage # Basic usage
NameToUnix /path/to/files ntu /path/to/files
# Only preview the changes without actual renaming # Only preview the changes without actual renaming
NameToUnix -n /path/to/files ntu -n /path/to/files
# Process multiple paths # Process multiple paths
NameToUnix /path1 /path2 /path3 ntu /path1 /path2 /path3
# Exclude specific files # Exclude specific files
NameToUnix -e “*.tmp” -e “backup_*” /path/to/files ntu -e "*.tmp" -e "backup_*" /path/to/files
# Increase verbosity # Increase verbosity
NameToUnix -v /path/to/files ntu -v /path/to/files
# Also rename the root directory # Also rename the root directory
NameToUnix --modify-root /path/to/files ntu --modify-root /path/to/files
``` ```
## Verwendung ## Verwendung
```bash ```bash
# Grundlegende Verwendung # Grundlegende Verwendung
NameToUnix /pfad/zu/dateien ntu /pfad/zu/dateien
# Nur Vorschau der Änderungen ohne tatsächliche Umbenennung # Nur Vorschau der Änderungen ohne tatsächliche Umbenennung
NameToUnix -n /pfad/zu/dateien ntu -n /pfad/zu/dateien
# Mehrere Pfade verarbeiten # Mehrere Pfade verarbeiten
NameToUnix /pfad1 /pfad2 /pfad3 ntu /pfad1 /pfad2 /pfad3
# Bestimmte Dateien ausschließen # Bestimmte Dateien ausschließen
NameToUnix -e "*.tmp" -e "backup_*" /pfad/zu/dateien ntu -e "*.tmp" -e "backup_*" /pfad/zu/dateien
# Verbosity erhöhen # Verbosity erhöhen
NameToUnix -v /pfad/zu/dateien ntu -v /pfad/zu/dateien
# Auch das Wurzelverzeichnis umbenennen # Auch das Wurzelverzeichnis umbenennen
NameToUnix --modify-root /pfad/zu/dateien ntu --modify-root /pfad/zu/dateien
``` ```
## Configuration File / Konfiguration ## Configuration File / Konfiguration
@ -146,7 +146,7 @@ You should also create a central configuration file /etc/NameToUnix/config.toml
# Dadurch werden in den Dateinamen alle "foo" durch "bar" ersetzt, und "old" durch "neu". # Dadurch werden in den Dateinamen alle "foo" durch "bar" ersetzt, und "old" durch "neu".
# WICHTIG: Die hartcodierten Transformationen sind aber immer vorrangig und lassen sich auch nicht rückgängig machen. # WICHTIG: Die hartcodierten Transformationen sind aber immer vorrangig und lassen sich auch nicht rückgängig machen.
# Die persönlichen Einstellungen überschreiben diese Einstellungen. # Die persönlichen Einstellungen überschreiben diese Einstellungen.
# VORSICHT! Zuerst mit 'NameToUnix -n <path>' testen # VORSICHT! Zuerst mit 'ntu -n <path>' testen
# -------------------------------------------- # --------------------------------------------
# In this file, any additional key-value pairs can be stored under [replacements], # In this file, any additional key-value pairs can be stored under [replacements],
# which are replaced in the file master name. For example: # which are replaced in the file master name. For example:
@ -159,7 +159,7 @@ You should also create a central configuration file /etc/NameToUnix/config.toml
# IMPORTANT: The hard-coded transformations always have priority and cannot be undone. # IMPORTANT: The hard-coded transformations always have priority and cannot be undone.
# The personal settings overwrite these settings. # The personal settings overwrite these settings.
# BE CAREFUL! First test with 'NameToUnix -n <path>' (Just display the changes) # BE CAREFUL! First test with 'ntu -n <path>' (Just display the changes)
[replacements] [replacements]
".." = "." ".." = "."
@ -171,10 +171,10 @@ You should also create a central configuration file /etc/NameToUnix/config.toml
### Verwendung von NameToUnix ### Verwendung von NameToUnix
Um die Verwendung von `NameToUnix` zu verstehen, kannst du die folgende Hilfe ausgeben: Um die Verwendung von `ntu` zu verstehen, kannst du die folgende Hilfe ausgeben:
```text ```text
NameToUnix --help ntu --help
``` ```
Die Ausgabe sieht wie folgt aus: Die Ausgabe sieht wie folgt aus:
@ -182,7 +182,7 @@ Die Ausgabe sieht wie folgt aus:
```text ```text
Ein Tool zum Anpassen von Verzeichnis- und Dateinamen an Linux-Konventionen Ein Tool zum Anpassen von Verzeichnis- und Dateinamen an Linux-Konventionen
Usage: NameToUnix [OPTIONS] [PATHS]... Usage: ntu [OPTIONS] [PATHS]...
Arguments: Arguments:
[PATHS]... Pfade (Dateien und Verzeichnisse) zum rekursiven Anpassen [PATHS]... Pfade (Dateien und Verzeichnisse) zum rekursiven Anpassen
@ -204,7 +204,7 @@ Options:
```text ```text
A tool for adapting directories and file names to Linux conventions A tool for adapting directories and file names to Linux conventions
Usage: NameToUnix [OPTIONS] [PATHS]... Usage: ntu [OPTIONS] [PATHS]...
Arguments: Arguments:
[PATHS]... Paths (files and directories) for recursive customization [PATHS]... Paths (files and directories) for recursive customization
@ -224,17 +224,17 @@ Options:
## Test ## Test
Im Verzeichnis [***./test***](./test) gibt es ein bash-Skript [***create_test_tree.sh***](test/create_test_tree.sh), das lokal 21 Test-Verzeichnisse und 400 Dateien mit skurrilen Zufallsnamen erzeugt. Damit kannst Du ***NameToUnix*** ausprobieren: Im Verzeichnis [***./test***](./test) gibt es ein bash-Skript [***create_test_tree.sh***](test/create_test_tree.sh), das lokal 21 Test-Verzeichnisse und 400 Dateien mit skurrilen Zufallsnamen erzeugt. Damit kannst Du ***NameToUnix*** ausprobieren:
***NameToUnix -n ./testverzeichnis*** (nur Anzeige der Änderungen) ***ntu -n ./testverzeichnis*** (nur Anzeige der Änderungen)
oder oder
***NameToUnix ./testverzeichnis*** (Anzeige mit Umbenennen). ***ntu ./testverzeichnis*** (Anzeige mit Umbenennen).
In the directory [***./test***](./test) there is a bash script [***create_test_tree.sh***](test/create_test_tree.sh), which locally creates 21 test directories and 400 files with bizarre random names. You can use this to try out ***NameToUnix***: In the directory [***./test***](./test) there is a bash script [***create_test_tree.sh***](test/create_test_tree.sh), which locally creates 21 test directories and 400 files with bizarre random names. You can use this to try out ***NameToUnix***:
***NameToUnix -n ./testverzeichnis*** (display changes only) ***ntu -n ./testverzeichnis*** (display changes only)
or or
***NameToUnix ./testverzeichnis*** (display with renaming). ***ntu ./testverzeichnis*** (display with renaming).
## Lizenz / License ## Lizenz / License