From f924800387ccddb685a11b280bee225f39555a0f Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Wed, 28 May 2025 02:28:45 +0300 Subject: [PATCH] 0.0.12 --- source/app.d | 48 ++++++++++++++++++++++++++++++++++-------- source/snag/version_.d | 2 +- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/source/app.d b/source/app.d index b15d19c..ef30132 100644 --- a/source/app.d +++ b/source/app.d @@ -63,6 +63,14 @@ int main(string[] args) "must contain an email address" ) ) + .add(new Flag(null, "no-presnag", "Execution without running pre-execution commands") + .name("nopre") + .optional + ) + .add(new Flag(null, "no-postsnag", "Execution without running post-execution commands") + .name("nopost") + .optional + ) ) .add(new Command("export", "Export snapshot to a tar.gz archive") .add(new Argument("path", "Output directory path for the archive").required) @@ -96,6 +104,14 @@ int main(string[] args) "must contain an email address" ) ) + .add(new Flag(null, "no-presnag", "Execution without running pre-execution commands") + .name("nopre") + .optional + ) + .add(new Flag(null, "no-postsnag", "Execution without running post-execution commands") + .name("nopost") + .optional + ) ) .add(new Command("list", "List of snapshots") .add(new Flag("c", "comment", "Show comment") @@ -113,6 +129,14 @@ int main(string[] args) ) .add(new Command("restore", "Restore to the specified snapshot state") .add(new Argument("snapshot", "Specify snapshot hash").required) + .add(new Flag(null, "no-presnag", "Execution without running pre-execution commands") + .name("nopre") + .optional + ) + .add(new Flag(null, "no-postsnag", "Execution without running post-execution commands") + .name("nopost") + .optional + ) ) .add(new Option("c", "config", "Сonfiguration file path") .optional @@ -147,13 +171,15 @@ int main(string[] args) .on("status", status => snag.status() ) - .on("create", create => + .on("create", (create) { + create.flag("nopre") || snag.executePreSnag(); snag.create( create.option("comment", ""), create.option("author", ""), create.option("email", "") - ) - ) + ); + create.flag("nopost") || snag.executePostSnag(); + }) .on("list", list => snag.list( list.flag("comment"), @@ -161,23 +187,27 @@ int main(string[] args) list.flag("email") ) ) - .on("restore", restore => - snag.restore(restore.arg("snapshot")) - ) + .on("restore", (restore) { + restore.flag("nopre") || snag.executePreSnag(); + snag.restore(restore.arg("snapshot")); + restore.flag("nopost") || snag.executePostSnag(); + }) .on("export", e => snag.exportSnapshot( e.arg("path"), e.option("snapshot", ""), ) ) - .on("import", i => + .on("import", (i) { + i.flag("nopre") || snag.executePreSnag(); snag.importSnapshot( i.arg("archive"), i.option("comment", ""), i.option("author", ""), i.option("email", "") - ) - ) + ); + i.flag("nopost") || snag.executePostSnag(); + }) .on("rules", (r) { auto rules = new SnagRules(config); r diff --git a/source/snag/version_.d b/source/snag/version_.d index 2c89ac7..b3c91c4 100644 --- a/source/snag/version_.d +++ b/source/snag/version_.d @@ -1,3 +1,3 @@ module snag.version_; -enum snagVersion = "0.0.11"; +enum snagVersion = "0.0.12";