Class: AudioAddict::Commands::LogCmd

Inherits:
Base
  • Object
show all
Defined in:
lib/audio_addict/commands/log.rb

Instance Method Summary collapse

Methods inherited from Base

#current_channel, #current_network, #needs, #prompt, #radio, #require_premium_account

Instance Method Details

#show_command(args) ⇒ Object



22
23
24
25
# File 'lib/audio_addict/commands/log.rb', line 22

def show_command(args)
  setup
  puts File.read(logfile)
end

#sort_command(args) ⇒ Object



33
34
35
36
37
38
# File 'lib/audio_addict/commands/log.rb', line 33

def sort_command(args)
  setup
  lines = File.readlines logfile
  File.write logfile, lines.sort.join
  say "!txtgrn!Sorted"
end

#tail_command(args) ⇒ Object



27
28
29
30
31
# File 'lib/audio_addict/commands/log.rb', line 27

def tail_command(args)
  setup
  lines = args['--lines'].to_i
  puts File.readlines(logfile)[-lines..-1]
end