Class: Switchboard::Commands::Roster::Remove

Inherits:
Switchboard::Command show all
Defined in:
lib/switchboard/commands/roster/remove.rb

Constant Summary

Constants inherited from Switchboard::Command

Switchboard::Command::DEFAULT_OPTIONS, Switchboard::Command::OPTIONS

Class Method Summary collapse

Methods inherited from Switchboard::Command

description, help, hide!, inherited, to_command, to_command_name, unregister!

Class Method Details

.options(opts) ⇒ Object



7
8
9
10
# File 'lib/switchboard/commands/roster/remove.rb', line 7

def self.options(opts)
  super(opts)
  # opts.on("-l", "--log=path", String, "Specifies a path to log script output.") { |v| OPTIONS[:log] = v }
end

.run!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/switchboard/commands/roster/remove.rb', line 12

def self.run!
  # TODO override settings with values from the command line
  switchboard = Switchboard::Core.new do
    ARGV.each do |jid|
      if (items = roster.find(jid)).any?
        item = items.values.first
        puts "Removing #{item.jid.to_s} from my roster..."
        item.remove
      end
    end
  end

  switchboard.run!
end