summaryrefslogtreecommitdiffstats
path: root/backup/src
diff options
context:
space:
mode:
authorLeonard Kugis <leonard@kug.is>2025-04-12 14:25:41 +0200
committerLeonard Kugis <leonard@kug.is>2025-04-12 14:25:41 +0200
commitbfc6151397b6a3d240687e6faba06175f5504770 (patch)
tree859902145d3c8d94a7ace5dc1ff769f409dd56c2 /backup/src
parente33322d98311ab7cfebe85e2cc7f57fabee87461 (diff)
downloadscripts-bfc6151397b6a3d240687e6faba06175f5504770.tar.gz
backup: Made cycle count configurable
Diffstat (limited to 'backup/src')
-rw-r--r--backup/src/main.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/backup/src/main.rs b/backup/src/main.rs
index 272c952..22b573f 100644
--- a/backup/src/main.rs
+++ b/backup/src/main.rs
@@ -11,18 +11,27 @@ use std::{
process::Command,
};
+/// Backup-Tool mit inkrementeller Sicherung und Rotation
+#[derive(Parser, Debug)]
+#[command(author, version, about, long_about = None)]
+struct Args {
+ /// Pfad zur Konfigurationsdatei (JSON)
+ #[arg(short, long)]
+ config: PathBuf,
+
+ /// Ausführliche Ausgabe
+ #[arg(short, long, default_value_t = false)]
+ verbose: bool,
+}
+
#[derive(Debug, Deserialize)]
-struct BackupConfig {
+struct Config {
backup_dir: String,
rotate_dir: String,
timestamp_file: String,
source_file: String,
exclude_file: String,
-}
-
-#[derive(Debug, Deserialize)]
-struct Config {
- backup: BackupConfig,
+ cycles: Option<u32>
}
fn read_lines<P: AsRef<Path>>(path: P) -> Result<Vec<String>, Box<dyn Error>> {