Class: SwarmCLI::MigrateOptions

Inherits:
Object
  • Object
show all
Includes:
TTY::Option
Defined in:
lib/swarm_cli/migrate_options.rb

Instance Method Summary collapse

Instance Method Details

#input_fileObject

Convenience accessors that delegate to params



46
47
48
# File 'lib/swarm_cli/migrate_options.rb', line 46

def input_file
  params[:input_file]
end

#outputObject



50
51
52
# File 'lib/swarm_cli/migrate_options.rb', line 50

def output
  params[:output]
end

#validate!Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/swarm_cli/migrate_options.rb', line 32

def validate!
  errors = []

  # Input file must exist
  if input_file && !File.exist?(input_file)
    errors << "Input file not found: #{input_file}"
  end

  unless errors.empty?
    raise SwarmCLI::ExecutionError, errors.join("\n")
  end
end