Sha256: 3ffc0b28f5c420a91400c97016d26b961cb183f050d22177541d6063ea92bf2f

Contents?: true

Size: 810 Bytes

Versions: 1

Compression:

Stored size: 810 Bytes

Contents

# typed: true
# frozen_string_literal: true

require 'stringio'

module Spoom
  module Cli
    module Commands
      class Base < Thor
        no_commands do
          def say_error(message, status = "Error")
            status = set_color(status, :red)

            buffer = StringIO.new
            buffer << "#{status}: #{message}"
            buffer << "\n" unless message.end_with?("\n")

            $stderr.print(buffer.string)
            $stderr.flush
          end

          def in_sorbet_project?
            File.file?(Spoom::Config::SORBET_CONFIG)
          end

          def in_sorbet_project!
            unless in_sorbet_project?
              say_error("not in a Sorbet project (no sorbet/config)")
              exit(1)
            end
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spoom-1.0.4 lib/spoom/cli/commands/base.rb