Class: Foobara::Agent::ListCommands

Inherits:
Command
  • Object
show all
Defined in:
foobara-agent-0.1.0/src/foobara/agent/list_commands.rb

Constant Summary

Constants included from TruncatedInspect

TruncatedInspect::MAX_LENGTH

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Command

install!

Methods included from TruncatedInspect

#inspect, truncating

Methods included from Concern

foobara_class_methods_module_for, foobara_concern?, included

Instance Attribute Details

#command_listsObject

Returns the value of attribute command_lists.



21
22
23
# File 'src/foobara/agent/list_commands.rb', line 21

def command_lists
  @command_lists
end

Instance Method Details

#construct_command_listsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'src/foobara/agent/list_commands.rb', line 23

def construct_command_lists
  user_provided_commands = []
  agent_specific_commands = []

  command_connector.all_transformed_command_classes.each do |command_class|
    if command_class.domain == Foobara::Agent
      agent_specific_commands
    else
      user_provided_commands
    end << command_class.full_command_name
  end

  self.command_lists = { user_provided_commands:, agent_specific_commands: }
end

#executeObject



15
16
17
18
19
# File 'src/foobara/agent/list_commands.rb', line 15

def execute
  construct_command_lists

  command_lists
end