diff options
| author | Szymon Szukalski <szymon@skas.io> | 2024-10-24 11:32:34 +1100 |
|---|---|---|
| committer | Szymon Szukalski <szymon@skas.io> | 2024-10-24 11:32:34 +1100 |
| commit | 1d1b3511e4c523458d78653cb8781a5328600387 (patch) | |
| tree | f5136cae86571c104c9f4728ef314da898e02067 /lib/cli.rb | |
| parent | 9986c89c2122f178148d690be336217f754d5633 (diff) | |
Implement main executable and CLI
Diffstat (limited to 'lib/cli.rb')
| -rw-r--r-- | lib/cli.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/cli.rb b/lib/cli.rb new file mode 100644 index 0000000..f2b185d --- /dev/null +++ b/lib/cli.rb @@ -0,0 +1,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 |
