Sha256: 20200c49690c0c0270ec0e72eb87d14a8d9879287b02d89027d74ed0d1616a4d

Contents?: true

Size: 746 Bytes

Versions: 298

Compression:

Stored size: 746 Bytes

Contents

require "appsignal/cli/helpers"

module CLIHelpers
  def cli
    Appsignal::CLI
  end

  def run_cli(command, options = {})
    cli.run(format_cli_arguments_and_options(command, options))
  end

  def format_cli_arguments_and_options(command, options = {})
    [*command].tap do |o|
      options.each do |key, value|
        o << (value.nil? ? "--#{key}" : "--#{key}=#{value}")
      end
    end
  end

  def add_cli_input(value)
    $stdin.puts value
  end

  def prepare_cli_input
    # Prepare the input by rewinding the pointer in the StringIO
    $stdin.rewind
  end

  def colorize(*args)
    ColorizeHelper.colorize(*args)
  end
end

module ColorizeHelper
  extend Appsignal::CLI::Helpers

  def self.colorize(*_args)
    super
  end
end

Version data entries

298 entries across 298 versions & 1 rubygems

Version Path
appsignal-4.0.6-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.6 spec/support/helpers/cli_helpers.rb
appsignal-4.0.5-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.5 spec/support/helpers/cli_helpers.rb
appsignal-4.0.4-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.4 spec/support/helpers/cli_helpers.rb
appsignal-4.0.3-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.3 spec/support/helpers/cli_helpers.rb
appsignal-4.0.2-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.2 spec/support/helpers/cli_helpers.rb
appsignal-4.0.1-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.1 spec/support/helpers/cli_helpers.rb
appsignal-4.0.0-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.0 spec/support/helpers/cli_helpers.rb
appsignal-3.13.1-java spec/support/helpers/cli_helpers.rb
appsignal-3.13.1 spec/support/helpers/cli_helpers.rb
appsignal-3.13.1.alpha.1-java spec/support/helpers/cli_helpers.rb
appsignal-3.13.1.alpha.1 spec/support/helpers/cli_helpers.rb
appsignal-4.0.0.beta.2-java spec/support/helpers/cli_helpers.rb
appsignal-4.0.0.beta.2 spec/support/helpers/cli_helpers.rb