18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/fast_exists/cli.rb', line 18
def run
command = @args.shift
case command
when "stats"
puts FastExists.stats(format: @options[:format])
when "health"
health = FastExists.health!
if @options[:format] == :json
puts JSON.pretty_generate(health)
else
puts "Operational Health Status: #{health[:overall_status].to_s.upcase}"
health[:checks].each do |check|
mark = check[:status] == :pass ? "✓" : "⚠"
puts " #{mark} #{check[:name]}: #{check[:message]}"
end
end
when "analyze"
res = FastExists.analyze!(format: @options[:format])
puts res.is_a?(String) ? res : JSON.pretty_generate(res)
when "audit"
res = FastExists.audit!
puts JSON.pretty_generate(res)
when "doctor"
puts FastExists.doctor!(format: @options[:format])
when "report"
output_path = @options[:output] || default_output_path(@options[:format])
FastExists.report!(format: @options[:format], output: output_path)
when "benchmark"
require_relative "../../benchmarks/benchmark_suite"
FastExists::BenchmarkSuite.run!
when "rebuild"
model = @args.shift
attr = @args.shift
puts "Rebuilding #{model} #{attr}..."
when "verify"
puts "FastExists Filter Status: OK (0.00% FP Rate)"
when "version", "-v", "--version"
puts "fast_exists v#{FastExists::VERSION}"
else
puts_help
end
end
|