Class: Wheneverd::CLI::Current

Inherits:
Wheneverd::CLI show all
Defined in:
lib/wheneverd/cli/current.rb

Overview

Implements wheneverd current (print installed unit files from disk).

Instance Method Summary collapse

Methods inherited from Wheneverd::CLI

#handle_error, #identifier_value, #load_schedule

Instance Method Details

#executeObject



6
7
8
9
10
11
12
# File 'lib/wheneverd/cli/current.rb', line 6

def execute
  paths = Wheneverd::Systemd::UnitLister.list(identifier: identifier_value, unit_dir: unit_dir)
  print_unit_files(paths)
  0
rescue StandardError => e
  handle_error(e)
end


14
15
16
17
18
19
20
# File 'lib/wheneverd/cli/current.rb', line 14

def print_unit_files(paths)
  paths.each_with_index do |path, idx|
    puts "# #{path}"
    puts File.read(path)
    puts "" if idx < paths.length - 1
  end
end