summaryrefslogtreecommitdiff
path: root/lib/cli.rb
blob: f2b185d5ad54da701bdcc58b9275ce7179ca38dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

class CLI
  def initialize(args)
    @args = args
    validate_arguments
  end

  def run
    file_path = @args[0]
    puts "Running actions from file: #{file_path} against the family tree."
  end

  private

  def validate_arguments
    if @args.empty?
      puts 'Usage: family_tree <path/to/actions.txt>'
      puts 'Please provide the path to the actions file.'
      exit 1
    end

    file_path = @args[0]
    return if File.exist?(file_path)

    puts "Error: The file '#{file_path}' does not exist."
    exit 1
  end
end