2 class Application::Completion<MCollective::Application
3 description "Helper for shell completion systems"
5 exclude_argument_sections "common", "filter", "rpc"
8 :description => "List all known agents",
9 :arguments => "--list-agents",
14 :description => "List all actions for an agent",
15 :arguments => "--list-actions",
20 :description => "List all inputs for an action",
21 :arguments => "--list-inputs",
25 option :list_applications,
26 :description => "List all known applications",
27 :arguments => "--list-applications",
32 :description => "The agent to operate on",
33 :arguments => "--agent AGENT",
37 :description => "The action to operate on",
38 :arguments => "--action ACTION",
43 PluginManager.find(:agent, "ddl").each do |agent|
46 puts "%s:%s" % [ agent, ddl.meta[:description] ]
51 PluginManager.find(:agent, "ddl").each {|p| puts p}
56 abort "Please specify an agent to list actions for" unless configuration[:agent]
59 ddl = DDL.new(configuration[:agent], :agent)
61 ddl.actions.sort.each do |action|
62 puts "%s:%s" % [action, ddl.action_interface(action)[:description]]
65 DDL.new(configuration[:agent], :agent).actions.sort.each {|a| puts a}
71 abort "Please specify an action and agent to list inputs for" unless configuration[:agent] && configuration[:action]
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]]
80 DDL.new(configuration[:agent], :agent).action_interface(configuration[:action])[:input].keys.sort.each {|i| puts i}
87 Applications.list.each do |app|
88 puts "%s:%s" % [app, Applications[app].application_description]
91 Applications.list.each {|a| puts a}
96 actions = configuration.keys.map{|k| k.to_s}.grep(/^list_/)
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