Sha256: 311ac6c2298ca4867f16345bac925dc4521c778b7e27c99ac5168a8dcfbb253c

Contents?: true

Size: 1.16 KB

Versions: 44

Compression:

Stored size: 1.16 KB

Contents

module CMSScanner
  module Formatter
    # CLI Formatter
    class Cli < Base
      # @return [ String ]
      def info_icon
        green('[+]')
      end

      # @return [ String ]
      def notice_icon
        blue('[i]')
      end

      # @return [ String ]
      def warning_icon
        amber('[!]')
      end

      # @return [ String ]
      def critical_icon
        red('[!]')
      end

      # @param [ String ] text
      # @return [ String ]
      def bold(text)
        colorize(text, 1)
      end

      # @param [ String ] text
      # @return [ String ]
      def red(text)
        colorize(text, 31)
      end

      # @param [ String ] text
      # @return [ String ]
      def green(text)
        colorize(text, 32)
      end

      # @param [ String ] text
      # @return [ String ]
      def amber(text)
        colorize(text, 33)
      end

      # @param [ String ] text
      # @return [ String ]
      def blue(text)
        colorize(text, 34)
      end

      # @param [ String ] text
      # @param [ Integer ] color_code
      # @return [ String ]
      def colorize(text, color_code)
        "\e[#{color_code}m#{text}\e[0m"
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
cms_scanner-0.0.41.10 app/formatters/cli.rb
cms_scanner-0.0.41.9 app/formatters/cli.rb
cms_scanner-0.0.41.8 app/formatters/cli.rb
cms_scanner-0.0.41.7 app/formatters/cli.rb
cms_scanner-0.0.41.6 app/formatters/cli.rb
cms_scanner-0.0.41.5 app/formatters/cli.rb
cms_scanner-0.0.41.4 app/formatters/cli.rb
cms_scanner-0.0.41.3 app/formatters/cli.rb
cms_scanner-0.0.41.2 app/formatters/cli.rb
cms_scanner-0.0.41.1 app/formatters/cli.rb
cms_scanner-0.0.41.0 app/formatters/cli.rb
cms_scanner-0.0.40.3 app/formatters/cli.rb
cms_scanner-0.0.40.2 app/formatters/cli.rb
cms_scanner-0.0.40.1 app/formatters/cli.rb
cms_scanner-0.0.40 app/formatters/cli.rb
cms_scanner-0.0.39.4 app/formatters/cli.rb
cms_scanner-0.0.39.3 app/formatters/cli.rb
cms_scanner-0.0.39.2 app/formatters/cli.rb
cms_scanner-0.0.39.1 app/formatters/cli.rb
cms_scanner-0.0.39.0 app/formatters/cli.rb