Class: CMSScanner::Formatter::Cli

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

Overview

CLI Formatter

Direct Known Subclasses

CliNoColour

Constant Summary

Constants inherited from Base

Base::ERB_SUPPORTS_KVARGS

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)


47
48
49
# File 'app/formatters/cli.rb', line 47

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

#blue(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


53
54
55
# File 'app/formatters/cli.rb', line 53

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

#bold(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


29
30
31
# File 'app/formatters/cli.rb', line 29

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

#colorize(text, color_code) ⇒ String

Parameters:

  • text (String)
  • color_code (Integer)

Returns:

  • (String)


60
61
62
# File 'app/formatters/cli.rb', line 60

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

#critical_iconString

Returns:

  • (String)


23
24
25
# File 'app/formatters/cli.rb', line 23

def critical_icon
  red('[!]')
end

#green(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


41
42
43
# File 'app/formatters/cli.rb', line 41

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

#info_iconString

Returns:

  • (String)


8
9
10
# File 'app/formatters/cli.rb', line 8

def info_icon
  green('[+]')
end

#notice_iconString

Returns:

  • (String)


13
14
15
# File 'app/formatters/cli.rb', line 13

def notice_icon
  blue('[i]')
end

#red(text) ⇒ String

Parameters:

  • text (String)

Returns:

  • (String)


35
36
37
# File 'app/formatters/cli.rb', line 35

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

#warning_iconString

Returns:

  • (String)


18
19
20
# File 'app/formatters/cli.rb', line 18

def warning_icon
  amber('[!]')
end