Class: Switchboard::Commands::Disco::Info
- Inherits:
-
Switchboard::Command
- Object
- Switchboard::Command
- Switchboard::Commands::Disco::Info
- Defined in:
- lib/switchboard/commands/disco/info.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 27 28 29 30 31 32 33 34 35 |
# File 'lib/switchboard/commands/disco/info.rb', line 9 def self.run! switchboard = Switchboard::Client.new do helper = Jabber::Discovery::Helper.new(client) resp = helper.get_info_for(settings["disco.target"], settings["disco.node"]) if resp.identities.any? || resp.features.any? puts "Discovery Info for #{settings["disco.target"]}#{settings["disco.node"] ? " (#{settings["disco.node"]})" : ""}" if resp.identities.any? puts "Identities:" resp.identities.each do |identity| puts " #{identity.category}/#{identity.type}: #{identity.iname ? identity.iname : "n/a"}" end puts end puts "Features:" if resp.features.any? resp.features.each do |feature| puts " #{feature}" end else puts "No information was discoverable for #{settings["disco.target"]}" end end switchboard.run! end |