Sha256: b2a0f7077832593bf18c1050b52fd80f992faefe22ec772acaa34d503d5582c1

Contents?: true

Size: 507 Bytes

Versions: 35

Compression:

Stored size: 507 Bytes

Contents

require 'json'

require_relative 'renderer/base'
require_relative 'renderer/json'
require_relative 'renderer/text'

module Aptible
  module CLI
    module Renderer
      FORMAT_VAR = 'APTIBLE_OUTPUT_FORMAT'.freeze

      def self.current
        case (format = ENV[FORMAT_VAR])
        when 'json'
          Json.new
        when 'text'
          Text.new
        when nil
          Text.new
        else
          raise UserError, "Invalid #{FORMAT_VAR}: #{format}"
        end
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
aptible-cli-0.24.2 lib/aptible/cli/renderer.rb
aptible-cli-0.24.1 lib/aptible/cli/renderer.rb
aptible-cli-0.24.0 lib/aptible/cli/renderer.rb
aptible-cli-0.23.0 lib/aptible/cli/renderer.rb
aptible-cli-0.22.0 lib/aptible/cli/renderer.rb
aptible-cli-0.21.0 lib/aptible/cli/renderer.rb
aptible-cli-0.20.0 lib/aptible/cli/renderer.rb
aptible-cli-0.19.9 lib/aptible/cli/renderer.rb
aptible-cli-0.19.7 lib/aptible/cli/renderer.rb
aptible-cli-0.19.6 lib/aptible/cli/renderer.rb
aptible-cli-0.19.4 lib/aptible/cli/renderer.rb
aptible-cli-0.19.3 lib/aptible/cli/renderer.rb
aptible-cli-0.19.2 lib/aptible/cli/renderer.rb
aptible-cli-0.19.1 lib/aptible/cli/renderer.rb
aptible-cli-0.19.0 lib/aptible/cli/renderer.rb
aptible-cli-0.18.3 lib/aptible/cli/renderer.rb
aptible-cli-0.18.2 lib/aptible/cli/renderer.rb
aptible-cli-0.18.1 lib/aptible/cli/renderer.rb
aptible-cli-0.18.0 lib/aptible/cli/renderer.rb
aptible-cli-0.17.2 lib/aptible/cli/renderer.rb