Module: Cron

Defined in:
lib/kanseishitsu/cron.rb,
lib/kanseishitsu/cron/argument_parser.rb

Overview

Define module Cron

Defined Under Namespace

Classes: ArgumentsParser

Constant Summary collapse

LaunchAgentManager =
::LaunchAgentManager

Instance Method Summary collapse

Instance Method Details

#main(args = Cron::ArgumentsParser.parse) ⇒ Object

rubocop: disable Metrics/MethodLength



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/kanseishitsu/cron.rb', line 32

def main(args = Cron::ArgumentsParser.parse)
  log.log_level = args[:log_level]
  manager = Cron::LaunchAgentManager.new(args)
  if args[:show_all]
    manager.show_all_launch_agents
  elsif args[:list]
    manager.list_launch_agent_labels
  elsif args[:remove]
    manager.remove_launch_agent(args[:remove])
  else
    manager.create_launch_agent(
      args[:executable_path_with_args],
      nil,
      args[:cron_schedule]
    )
  end
end