Sha256: 3eb7e4be2773d8581229af3fb5517ca34834d55f6a50592c78917e98f5002532

Contents?: true

Size: 1.35 KB

Versions: 13

Compression:

Stored size: 1.35 KB

Contents

require 'optparse'

module Inch
  module CLI
    module Command
      # The classes in the Command::Output namespace act as presenter
      # objects to the classes in the Command namespace.
      #
      # They are given all the objects and data they are supposed
      # to display to the user. They do not filter the received data.
      #
      # @see Inch::CLI::Command::Suggest
      # @see Inch::CLI::Command::Output::Suggest
      module Output
        # Abstract base class for CLI output
        #
        # @abstract
        class Base
          include TraceHelper

          def display_name(object)
            if object.language == :javascript
              object.fullname+" in #{object.filename.relative_path}".color(:dark)
            else
              object.fullname
            end
          end

          def priority_arrow(priority, color = :white)
            Evaluation::PriorityRange.all.each do |range|
              return range.arrow.color(color).dark if range.include?(priority)
            end
          end

          def print_file_info(o, color)
            o.files.each do |f|
              echo "-> #{f.filename}:#{f.line_no}".color(color)
            end
            echo separator
          end

          # this is used to use Inch::Utils::BufferedIO
          def ui
            @options.ui
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
inch-0.7.1 lib/inch/cli/command/output/base.rb
inch-0.7.0 lib/inch/cli/command/output/base.rb
inch-0.6.4 lib/inch/cli/command/output/base.rb
inch-0.6.3 lib/inch/cli/command/output/base.rb
inch-0.6.2 lib/inch/cli/command/output/base.rb
inch-0.6.1 lib/inch/cli/command/output/base.rb
inch-0.6.0 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc6 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc5 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc4 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc3 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc2 lib/inch/cli/command/output/base.rb
inch-0.6.0.rc1 lib/inch/cli/command/output/base.rb