summaryrefslogtreecommitdiff
path: root/lib/cli.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cli.rb')
-rw-r--r--lib/cli.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/cli.rb b/lib/cli.rb
index 3087212..a252c71 100644
--- a/lib/cli.rb
+++ b/lib/cli.rb
@@ -2,12 +2,19 @@
require_relative 'action_file_executor'
+# CLI class to handle command-line interface operations.
class CLI
+ # Initializes the CLI with command-line arguments.
+ #
+ # @param args [Array<String>] The command-line arguments.
def initialize(args)
@args = args
validate_arguments
end
+ # Runs the CLI, executing actions from the provided file.
+ #
+ # @return [void]
def run
file_path = @args[0]
action_file_executor = ActionFileExecutor.new(file_path)
@@ -16,6 +23,10 @@ class CLI
private
+ # Validates the command-line arguments.
+ #
+ # @return [void]
+ # @raise [SystemExit] if no arguments are provided or the file does not exist.
def validate_arguments
if @args.empty?
puts 'Usage: family_tree <path/to/actions.txt>'