Class: Ec2spec::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/ec2spec/cli.rb

Instance Method Summary collapse

Instance Method Details

#sshObject

rubocop:disable Metrics/AbcSize, Metrics/MethodLength



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ec2spec/cli.rb', line 17

def ssh
  hosts = options['host']
  days = options['days']
  rate = options['rate']
  unit = options['unit']
  app_id = options['app_id']
  calc_type = options['calc_type']
  format = options['format'] || :plain_text
  region = options['region'] || 'ap-northeast-1'

  Ec2spec.logger.level = Logger::DEBUG if options['debug']
  client = Ec2spec::Client.new(hosts, days, format, region)
  if exchange_unit?(unit, rate, app_id)
    client.prepare_price_calculator(unit, rate,
                                    calc_type, app_id)
  end
  puts client.run
end