Class: Flumtter::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/flumtter/app/core/cli.rb

Defined Under Namespace

Classes: Command

Constant Summary collapse

@@events =
[]

Class Method Summary collapse

Class Method Details

.add(*args, &blk) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/flumtter/app/core/cli.rb', line 16

def add(*args, &blk)
  Initializer.add_opt do |opt, options|
    opt.on(*args){|v|options[args.first] = v}
  end
  Initializer.run(args.first) do |v, options|
    @@events << Command.new(blk, v)
  end
end

.multiuser(twitter) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/flumtter/app/core/cli.rb', line 32

def multiuser(twitter)
  if Setting[:names]
    Setting[:names].each do |name|
      twitter.set AccountSelector.select(name: name)
      yield
    end
  else
    yield
  end
end

.run(client) ⇒ Object



25
26
27
28
29
30
# File 'lib/flumtter/app/core/cli.rb', line 25

def run(client)
  unless @@events.empty?
    @@events.map{|event|event.run(client)}
    exit
  end
end