Class: Commands::ListActionCommand
- Inherits:
-
AbstractListCommand
- Object
- Command
- AbstractListCommand
- Commands::ListActionCommand
- Defined in:
- lib/commands.rb
Instance Attribute Summary
Attributes inherited from AbstractListCommand
#active, #all, #max_results, #no_steps, #state
Attributes inherited from Command
#arg, #commands, #description, #logger, #name
Instance Method Summary collapse
Methods inherited from Command
#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve, #validate
Constructor Details
This class inherits a constructor from Commands::Command
Instance Method Details
#enact(client) ⇒ Object
981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File 'lib/commands.rb', line 981 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) ⇒ Object
967 968 969 970 971 972 973 974 975 976 977 978 979 |
# File 'lib/commands.rb', line 967 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 |