From 05fda6c29f0fe4742b7ea6b237ea98f737b68b8b Mon Sep 17 00:00:00 2001 From: Szymon Szukalski Date: Fri, 25 Oct 2024 10:00:36 +1100 Subject: Document code with YARD --- lib/cli.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/cli.rb') 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] 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 ' -- cgit v1.2.3