Class: MetzScan::Commands::Rules

Inherits:
Object
  • Object
show all
Defined in:
lib/metz_scan/commands/rules.rb

Constant Summary collapse

ANSI_RESET =
"\e[0m"
ANSI_BOLD =
"\e[1m"
ANSI_CYAN =
"\e[36m"
ANSI_GREY =
"\e[90m"
USAGE =
"Usage: metz-scan rules [--json]"

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:) ⇒ Rules

Returns a new instance of Rules.



20
21
22
23
# File 'lib/metz_scan/commands/rules.rb', line 20

def initialize(stdout:, stderr:)
  @stdout = stdout
  @stderr = stderr
end

Class Method Details

.run(argv, stdout:, stderr:) ⇒ Object



16
17
18
# File 'lib/metz_scan/commands/rules.rb', line 16

def self.run(argv, stdout:, stderr:)
  new(stdout: stdout, stderr: stderr).run(argv)
end

Instance Method Details

#run(argv) ⇒ Object



25
26
27
28
29
30
# File 'lib/metz_scan/commands/rules.rb', line 25

def run(argv)
  options = parse_options(argv)
  cops = load_cops
  options[:json] ? emit_json(cops) : emit_table(cops)
  0
end