Class: CMSScanner::Formatter::Cli

Inherits:
Base
  • Object
show all
Defined in:
app/formatters/cli.rb

Overview

CLI Formatter

Direct Known Subclasses

CliNoColour

Instance Attribute Summary

Attributes inherited from Base

#controller_name

Instance Method Summary collapse

Methods inherited from Base

#base_format, #beautify, #format, #formats, #initialize, #output, #render, #template_vars, #user_interaction?, #view_path, #views_directories

Constructor Details

This class inherits a constructor from CMSScanner::Formatter::Base

Instance Method Details

#amber(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


45
46
47
# File 'app/formatters/cli.rb', line 45

def amber(text)
  colorize(text, 33)
end

#blue(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


51
52
53
# File 'app/formatters/cli.rb', line 51

def blue(text)
  colorize(text, 34)
end

#bold(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


27
28
29
# File 'app/formatters/cli.rb', line 27

def bold(text)
  colorize(text, 1)
end

#colorize(text, color_code) ⇒ String

Parameters:

  • text (String)
  • color_code (Integer)

Returns:

  • (String)


58
59
60
# File 'app/formatters/cli.rb', line 58

def colorize(text, color_code)
  "\e[#{color_code}m#{text}\e[0m"
end

#critical_iconString

Returns:

  • (String)


21
22
23
# File 'app/formatters/cli.rb', line 21

def critical_icon
  red('[!]')
end

#green(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


39
40
41
# File 'app/formatters/cli.rb', line 39

def green(text)
  colorize(text, 32)
end

#info_iconString

Returns:

  • (String)


6
7
8
# File 'app/formatters/cli.rb', line 6

def info_icon
  green('[+]')
end

#notice_iconString

Returns:

  • (String)


11
12
13
# File 'app/formatters/cli.rb', line 11

def notice_icon
  blue('[i]')
end

#red(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


33
34
35
# File 'app/formatters/cli.rb', line 33

def red(text)
  colorize(text, 31)
end

#warning_iconString

Returns:

  • (String)


16
17
18
# File 'app/formatters/cli.rb', line 16

def warning_icon
  amber('[!]')
end