This commit is contained in:
Alexander Zhirov 2025-05-24 22:01:59 +03:00
parent a193f53871
commit fe55e8680f
Signed by: alexander
GPG key ID: C8D8BE544A27C511
4 changed files with 24 additions and 13 deletions

3
.vscode/launch.json vendored
View file

@ -10,7 +10,8 @@
"dubBuild": true, "dubBuild": true,
"name": "Build & Debug DUB project", "name": "Build & Debug DUB project",
"cwd": "${command:dubWorkingDirectory}", "cwd": "${command:dubWorkingDirectory}",
"program": "bin/${command:dubTarget}" "program": "bin/${command:dubTarget}",
"args": ["list"]
} }
] ]
} }

View file

@ -1,6 +1,6 @@
{ {
"git": "/tmp/testgit", "git": "/tmp/testgit",
"project": "/home/alexander/Programming/new/dlang/snag/source", "project": "/tmp/test",
"email": "user@site.domain", "email": "user@site.domain",
"user": "snag", "user": "snag",
"presnag": [ "presnag": [

View file

@ -12,6 +12,10 @@ int main(string[] args)
.add(new Command("init", "Initializing the repository for storing snapshots")) .add(new Command("init", "Initializing the repository for storing snapshots"))
.add(new Command("status", "Checking the status of tracked files")) .add(new Command("status", "Checking the status of tracked files"))
.add(new Command("create", "Create a new backup")) .add(new Command("create", "Create a new backup"))
.add(new Command("list", "List of backups"))
.add(new Command("restore", "Restore to the specified snapshot state")
.add(new Argument("hash", "hash").required)
)
.add(new Option("c", "config", "Сonfiguration file path") .add(new Option("c", "config", "Сonfiguration file path")
.optional .optional
.validateEachWith( .validateEachWith(
@ -33,18 +37,24 @@ int main(string[] args)
} }
auto snag = new Snag(config); auto snag = new Snag(config);
import std.stdio;
try { try {
argumets argumets
.on("init", (init) { .on("init", init =>
snag.initialize(); snag.initialize()
}) )
.on("status", (status) { .on("status", status =>
snag.status(); snag.status()
}) )
.on("create", (create) { .on("create", create =>
snag.create(); snag.create()
}); )
.on("list", list =>
snag.list()
)
.on("restore", restore =>
snag.restore(restore.arg("hash"))
);
} catch (SnagException e) { } catch (SnagException e) {
e.print(); e.print();
return EXIT_FAILURE; return EXIT_FAILURE;

View file

@ -1,3 +1,3 @@
module snag.version_; module snag.version_;
enum snagVersion = "0.0.4"; enum snagVersion = "0.0.5";