Class: BackupMonitor::CLI

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

Instance Method Summary collapse

Instance Method Details

#check(base_path = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/backup_monitor/cli.rb', line 9

def check(base_path = nil)
	base_path ||= Dir.pwd

	checker = Checker.new warning_threshold: options[:threshold].to_i
	result = checker.check base_path
	if result.empty?
		STDOUT.puts 'No stale directories found'
	else
		STDERR.puts 'Found stale directories:'
		result.each_pair do |key, value|
			STDERR.puts "\t#{value} - #{key}"
		end
	end
end