Sha256: 3b7636362c6179b9ae18bc91dfcf2e98b72331ace3f3812dd2e20c62f6cf5da5

Contents?: true

Size: 1.25 KB

Versions: 31

Compression:

Stored size: 1.25 KB

Contents

# typed: strict
# frozen_string_literal: true

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

    sig { params(options: T::Hash[Symbol, T.untyped]).returns(T.nilable(String)) }
    def netrc_file(options)
      return if options[:auth]
      return unless options[:netrc]

      options[:netrc_file] || ENV["TAPIOCA_NETRC_FILE"] || File.join(ENV["HOME"].to_s, ".netrc")
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
tapioca-0.12.0 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.17 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.16 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.15 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.14 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.13 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.12 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.11 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.10 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.9 lib/tapioca/helpers/cli_helper.rb
tapioca-0.11.8 lib/tapioca/helpers/cli_helper.rb