Class: CronInfo::Cli

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

Instance Method Summary collapse

Instance Method Details

#runObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/cron_info/cli.rb', line 3

def run
  raise "Invalid number of arguments" unless ARGV.size > 5

  cron_strings = ARGV.slice(0, 5)
  command_string = ARGV.slice(5, (ARGV.size - 5)).join(" ")

  parser_result = CommandParser.new.parse(*cron_strings)
  parser_result.first(5).each do |(label, parsed_result)|
    puts '%-14.14s' % label + parsed_result.join(" ")
  end
  puts '%-14.14s' % 'command' + command_string
end