class MCollective::Application::Completion - mcollective version 2.12.5

# class MCollective::Application::Completion

### Public Instance Methods

list_actions() click to toggle source

       # File lib/mcollective/application/completion.rb
    55 def list_actions
    56   abort "Please specify an agent to list actions for" unless configuration[:agent]
    57
    58   if options[:verbose]
    59     ddl = DDL.new(configuration[:agent], :agent)
    60
    61     ddl.actions.sort.each do |action|
    62       puts "%s:%s" % [action, ddl.action_interface(action)[:description]]
    63     end
    64   else
    65     DDL.new(configuration[:agent], :agent).actions.sort.each {|a| puts a}
    66   end
    67 rescue
    68 end

list_agents() click to toggle source

       # File lib/mcollective/application/completion.rb
    41 def list_agents
    42   if options[:verbose]
    43     PluginManager.find(:agent, "ddl").each do |agent|
    44       begin
    45         ddl = DDL.new(agent)
    46         puts "%s:%s" % [ agent, ddl.meta[:description] ]
    47       rescue
    48       end
    49     end
    50   else
    51     PluginManager.find(:agent, "ddl").each {|p| puts p}
    52   end
    53 end

list_applications() click to toggle source

       # File lib/mcollective/application/completion.rb
    85 def list_applications
    86   if options[:verbose]
    87     Applications.list.each do |app|
    88       puts "%s:%s" % [app, Applications[app].application_description]
    89     end
    90   else
    91     Applications.list.each {|a| puts a}
    92   end
    93 end

list_inputs() click to toggle source

       # File lib/mcollective/application/completion.rb
    70 def list_inputs
    71   abort "Please specify an action and agent to list inputs for" unless configuration[:agent] && configuration[:action]
    72
    73   if options[:verbose]
    74     ddl = DDL.new(configuration[:agent], :agent)
    75     action = ddl.action_interface(configuration[:action])
    76     action[:input].keys.sort.each do |input|
    77       puts "%s:%s" % [input, action[:input][input][:description]]
    78     end
    79   else
    80     DDL.new(configuration[:agent], :agent).action_interface(configuration[:action])[:input].keys.sort.each {|i| puts i}
    81   end
    82 rescue
    83 end

main() click to toggle source

        # File lib/mcollective/application/completion.rb
     95 def main
     96   actions = configuration.keys.map{|k| k.to_s}.grep(/^list_/)
     97
     98   abort "Please choose either --list-[agents|actions|inputs|applications]" if actions.empty?
     99   abort "Please choose only one of --list-[agents|actions|inputs|applications]" if actions.size > 1
    100
    101   send actions.first
    102 end