From 7714bc498e608ab228d3845bbdd2550ea203d579 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Sat, 24 May 2025 01:39:20 +0300 Subject: [PATCH] 0.0.3 --- source/app.d | 23 +++++++++++++++++++++-- source/snapd/version_.d | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/source/app.d b/source/app.d index 3ac5b7a..72df7c3 100644 --- a/source/app.d +++ b/source/app.d @@ -2,8 +2,6 @@ import snapd; import commandr; import std.file; -import std.stdio : writeln; - import core.stdc.stdlib : EXIT_SUCCESS, EXIT_FAILURE; private string programName = "snapd"; @@ -11,6 +9,9 @@ private string programName = "snapd"; int main(string[] args) { auto argumets = new Program(programName, snapdVersion) + .add(new Command("init", "Initializing the repository for storing snapshots")) + .add(new Command("status", "Checking the status of tracked files")) + .add(new Command("create", "Create a new backup")) .add(new Option("c", "config", "Сonfiguration file path") .optional .validateEachWith( @@ -31,5 +32,23 @@ int main(string[] args) return EXIT_FAILURE; } + auto snapd = new Snapd(config); + + try { + argumets + .on("init", (init) { + snapd.initialize(); + }) + .on("status", (status) { + snapd.status(); + }) + .on("create", (create) { + snapd.create(); + }); + } catch (SnapdException e) { + e.print(); + return EXIT_FAILURE; + } + return EXIT_SUCCESS; } diff --git a/source/snapd/version_.d b/source/snapd/version_.d index 98d0114..bc63b1b 100644 --- a/source/snapd/version_.d +++ b/source/snapd/version_.d @@ -1,3 +1,3 @@ module snapd.version_; -enum snapdVersion = "0.0.2"; +enum snapdVersion = "0.0.3";