Class: Switchboard::Commands::Disco::Items
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::Disco::Items
- Defined in:
- lib/switchboard/commands/disco/items.rb
Class Method Summary collapse
Methods inherited from Switchboard::Command
description, help, options, to_command, to_command_name
Class Method Details
.run! ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/switchboard/commands/disco/items.rb', line 9 def self.run! switchboard = Switchboard::Client.new do helper = Jabber::Discovery::Helper.new(client) resp = helper.get_items_for(settings["disco.target"], settings["disco.node"]) if resp.items.any? puts "Item Discovery for #{settings["disco.target"]}#{settings["disco.node"] ? " (#{settings["disco.node"]})" : ""}" resp.items.each do |item| name = "#{item.iname}#{item.node ? " (#{item.node})" : ""}" puts " " + [item.jid, name].reject { |x| x == "" } * ": " end else puts "No items were discoverable for #{settings["disco.target"]}." end end switchboard.run! end |