Sha256: 3a67d593bf653cece735bf1a6a24e60902902193877eaabfe129c7979c6aa963

Contents?: true

Size: 1013 Bytes

Versions: 8

Compression:

Stored size: 1013 Bytes

Contents

# typed: strict
# frozen_string_literal: true

require "thor"

module Tapioca
  module CliHelper
    extend T::Sig
    extend T::Helpers

    requires_ancestor { Thor::Shell }

    sig { params(message: String, color: T.any(Symbol, T::Array[Symbol])).void }
    def say_error(message = "", *color)
      # Thor has its own `say_error` now, but it has two problems:
      # 1. it adds the padding around all the messages, even if they continue on
      #    the same line, and
      # 2. it accepts a last parameter which breaks the ability to pass color values
      #    as splats.
      #
      # So we implement our own version here to work around those problems.
      shell.indent(-shell.padding) do
        super(message, color)
      end
    end

    sig { params(options: T::Hash[Symbol, T.untyped]).returns(RBIFormatter) }
    def rbi_formatter(options)
      rbi_formatter = DEFAULT_RBI_FORMATTER
      rbi_formatter.max_line_length = options[:rbi_max_line_length]
      rbi_formatter
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tapioca-0.8.3 lib/tapioca/helpers/cli_helper.rb
tapioca-0.8.2 lib/tapioca/helpers/cli_helper.rb
tapioca-0.7.3 lib/tapioca/helpers/cli_helper.rb
tapioca-0.8.1 lib/tapioca/helpers/cli_helper.rb
tapioca-0.8.0 lib/tapioca/helpers/cli_helper.rb
tapioca-0.7.2 lib/tapioca/helpers/cli_helper.rb
tapioca-0.7.1 lib/tapioca/helpers/cli_helper.rb
tapioca-0.7.0 lib/tapioca/helpers/cli_helper.rb