This commit is contained in:
Alexander Zhirov 2025-05-24 01:39:20 +03:00
parent 66d64a9642
commit 7714bc498e
Signed by: alexander
GPG key ID: C8D8BE544A27C511
2 changed files with 22 additions and 3 deletions

View file

@ -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;
}

View file

@ -1,3 +1,3 @@
module snapd.version_;
enum snapdVersion = "0.0.2";
enum snapdVersion = "0.0.3";