Class: Wheneverd::CLI

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/wheneverd/cli.rb,
lib/wheneverd/cli.rb

Overview

Command-line interface for wheneverd.

This class defines global options and shared helpers used by each subcommand.

Defined Under Namespace

Classes: Activate, Current, Deactivate, Delete, Diff, Help, Init, Linger, Reload, Show, Status, Validate, Write

Instance Method Summary collapse

Instance Method Details

#handle_error(error) ⇒ Integer

Print an error message and return a non-zero exit status.

Parameters:

  • error (Exception)

Returns:

  • (Integer)


39
40
41
42
43
# File 'lib/wheneverd/cli.rb', line 39

def handle_error(error)
  warn error.message
  warn error.full_message if verbose?
  1
end

#identifier_valueString

Returns the identifier used for unit file names.

Returns:

  • (String)

    the identifier used for unit file names



19
20
21
# File 'lib/wheneverd/cli.rb', line 19

def identifier_value
  identifier || File.basename(Dir.pwd)
end

#load_scheduleWheneverd::Schedule

Load the configured schedule file.

Returns:



26
27
28
29
30
31
32
33
# File 'lib/wheneverd/cli.rb', line 26

def load_schedule
  path = File.expand_path(schedule)
  unless File.file?(path)
    raise Wheneverd::DSL::LoadError.new("Schedule file not found: #{path}", path: path)
  end

  Wheneverd::DSL::Loader.load_file(path)
end