Class: Ronin::CLI

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

Constant Summary collapse

"Focus timer for the solo developer.\nNo distraction. No mercy."

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(argv) ⇒ Object



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

def self.start(argv)
  new.run(argv)
end

Instance Method Details

#run(argv) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ronin/cli.rb', line 17

def run(argv)
  command = argv.shift

  if command.nil? || %w[-h --help].include?(command)
    puts help
    exit 0
  end

  case command
  when '-v', '--version'
    puts "ronin #{Ronin::VERSION}"
    exit 0
  when 'focus'
    handle_focus(argv)
  when 'rest'
    handle_rest(argv)
  when 'status'
    handle_status
  when 'log'
    handle_log(argv)
  when 'streak'
    handle_streak
  else
    warn "Unknown command: '#{command}'"
    puts help
    exit 1
  end
rescue StandardError => e
  warn "Error: #{e.message}"
  exit 1
end