Sha256: 360906ce947ca579b6464f33c9c38a49a3899d64b03339b2b167b55f1c7678de

Contents?: true

Size: 722 Bytes

Versions: 4

Compression:

Stored size: 722 Bytes

Contents

class Jets::CLI
  class Stacks < Base
    rescue_api_error

    def run
      params = paging_params.merge(options)
      resp = Jets::Api::Stack.list(params)
      log.info stacks_for_message
      present(resp[:data])
      paginate(resp)
    end

    private

    def stacks_for_message
      if options[:all_projects]
        "Stacks for all projects:"
      else
        "Stacks for project: #{Jets.project.name}"
      end
    end

    def present(items)
      presenter = CliFormat::Presenter.new(@options)
      presenter.empty_message = "No stacks found"
      items.each do |item|
        row = "#{item[:name]} #{item[:location]}"
        presenter.rows << [row]
      end
      presenter.show
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/cli/stacks.rb
jets-6.0.4 lib/jets/cli/stacks.rb
jets-6.0.3 lib/jets/cli/stacks.rb
jets-6.0.2 lib/jets/cli/stacks.rb