From 795fb0bdc470e490e0c02237d6bdea522e396b97 Mon Sep 17 00:00:00 2001 From: Alexander Zhirov Date: Thu, 29 May 2025 16:23:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA?= =?UTF-8?q?=D0=B8=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5=D1=80=D0=B0=20=D1=80?= =?UTF-8?q?=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=81=D0=BE=20=D1=81=D0=BD=D0=B8=D0=BC=D0=BA=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/snag/core/core.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/snag/core/core.d b/source/snag/core/core.d index 7b05b61..9917240 100644 --- a/source/snag/core/core.d +++ b/source/snag/core/core.d @@ -442,4 +442,21 @@ class Snag { writeln("Import completed successfully: ", newSnapshot); } + + void size() { + try { + "Total size of the snapshots is: %.2f MB".writefln( + dirEntries(_config.git, SpanMode.depth) + .filter!(path => path.isFile) + .array + .map!(path => path.getSize) + .sum / (1024.0 * 1024.0) + ); + } catch (Exception e) { + throw new SnagException( + "Error while checking the snapshots size:\n\t" + ~ e.msg + ); + } + } }