feat(sync): add rsync-like sync command with dry-run and bump version to v0.5.0

This commit is contained in:
harald committed 2026-09-16 10:40:38 +02:00
1 parent 3f3f8f2730
commit aa65d96434
8 files changed
+1350 -2

No files matched your search

+21
View File
@@ -100,6 +100,27 @@ pub fn magenta(s: &str) -> String {
}
}
/// Formatiert eine Byte-Anzahl lesbar in B, KB, MB, GB oder TB.
pub fn format_bytes(bytes: u64) -> String {
const KB: f64 = 1024.0;
const MB: f64 = KB * 1024.0;
const GB: f64 = MB * 1024.0;
const TB: f64 = GB * 1024.0;
let b = bytes as f64;
if b >= TB {
format!("{:.2} TB", b / TB)
} else if b >= GB {
format!("{:.2} GB", b / GB)
} else if b >= MB {
format!("{:.2} MB", b / MB)
} else if b >= KB {
format!("{:.2} KB", b / KB)
} else {
format!("{} B", bytes)
}
}
/// Gibt einen formatierten Fortschrittsschritt aus: ` [1/4] 📦 Schrittbeschreibung...`
pub fn step(num: u8, total: u8, icon: &str, msg: &str) {
let tag = cyan(&format!("[{}/{}]", num, total));