From dc75359792e4d4277341ae4a14fcc47929ee242f Mon Sep 17 00:00:00 2001 From: Mark van den Broek Date: Wed, 20 Nov 2024 02:27:16 +0100 Subject: [PATCH] Give an error when SVG already exists Resolves issue #4 --- app/Console/Commands/CompileNinjaSvgCommand.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Console/Commands/CompileNinjaSvgCommand.php b/app/Console/Commands/CompileNinjaSvgCommand.php index 4dc034d..7d80824 100644 --- a/app/Console/Commands/CompileNinjaSvgCommand.php +++ b/app/Console/Commands/CompileNinjaSvgCommand.php @@ -41,6 +41,12 @@ public function handle() return Command::INVALID; } + if ($this->option('force') === false && $inscription->fullSvgExists()) { + $this->error('SVG already exists. Use --force to overwrite it.'); + + return Command::FAILURE; + } + CompileNinjaSvg::dispatchSync($inscription, $this->option('force')); $this->info($inscription->name.' compiled into a SVG file successfully!');