Class: Filesortd::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/filesortd/cli.rb

Overview

CLI

Instance Method Summary collapse

Instance Method Details

#start(filename) ⇒ Object



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

def start(filename)
  puts 'Started filesortd'
  begin
    scpt = Script.new
    scpt.instance_eval File.read(filename)
    loop { sleep 0.1 }
    # sleep to prevent 100% cpu load
  rescue Interrupt
    scpt.listeners.each do |l|
      l.stop
    end
    puts 'Stopped filesortd'
  end
end

#versionObject



36
37
38
# File 'lib/filesortd/cli.rb', line 36

def version
  puts ::Filesortd::VERSION
end