Class: Songbirdsh::Cli

Inherits:
Object
  • Object
show all
Includes:
ShellShock::Context
Defined in:
lib/songbirdsh/cli.rb

Instance Method Summary collapse

Constructor Details

#initializeCli

Returns a new instance of Cli.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/songbirdsh/cli.rb', line 22

def initialize
  preferences = Preferences.new
  @player = Player.new preferences
  at_exit { @player.stop }
  @prompt = "songbirdsh > "
  with :status, "'"
  with :show_properties, 'show'
  with :restart, 'next'
  with :enqueue, '+'
  with_all *%w{reload search start stop scrobbling shuffle list setup_scrobbling recent flush}
end

Instance Method Details

#with(name, *aliases) ⇒ Object



13
14
15
16
# File 'lib/songbirdsh/cli.rb', line 13

def with name, *aliases
  aliases << name.to_s if aliases.empty?
  add_command Command.load(name, @player), *aliases
end

#with_all(*names) ⇒ Object



18
19
20
# File 'lib/songbirdsh/cli.rb', line 18

def with_all *names
  names.each {|name| with name}
end