class Commands::ListActionCommand

Public Instance Methods

enact(client) click to toggle source
Calls superclass method Commands::AbstractListCommand#enact
# File lib/commands.rb, line 1019
def enact(client)
  result = super(client)
  job_flows = result['JobFlows']
  count = 0
  for job_flow in job_flows do 
    if get_field(:max_results) && (count += 1) > get_field(:max_results) then
      break
    end
    logger.puts format(job_flow, ['JobFlowId', 20], ['ExecutionStatusDetail.State', 15], 
                ['Instances.MasterPublicDnsName', 50]) + job_flow['Name']
    if ! get_field(:no_steps) then
      for step in job_flow['Steps'] do
        logger.puts "   " + format(step, ['ExecutionStatusDetail.State', 15], ['StepConfig.Name', 30])
      end
    end
  end
end
format(map, *fields) click to toggle source
# File lib/commands.rb, line 1005
def format(map, *fields)
  result = []
  for field in fields do
    key = field[0].split(".")
    value = map
    while key.size > 0 do
      value = value[key.first]
      key.shift
    end
    result << sprintf("%-#{field[1]}s", value)
  end
  result.join("")
end