From 422c95dba95deeb06a72281971acbfebf3eb6e97 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Wed, 12 Jun 2024 18:56:36 +0800 Subject: [PATCH] feat: fail when directory doesn't exist --- lib/poepod/cli.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/poepod/cli.rb b/lib/poepod/cli.rb index 3139b83..d8fa27f 100644 --- a/lib/poepod/cli.rb +++ b/lib/poepod/cli.rb @@ -12,6 +12,12 @@ class Cli < Thor def concat(directory, output_file = nil) dir_path = Pathname.new(directory) + # Check if the directory exists + unless dir_path.directory? + puts "Error: Directory '#{directory}' does not exist." + exit(1) + end + dir_path = dir_path.expand_path unless dir_path.absolute? output_file ||= "#{dir_path.basename}.txt"