Sha256: f3f0f192f41b3d1834bd36623f6a1440d940e5a42d790526708e581d59f1fadb

Contents?: true

Size: 1.13 KB

Versions: 15

Compression:

Stored size: 1.13 KB

Contents

module Jets::Command
  class StacksCommand < Base # :nodoc:
    desc "stacks", "List deployed stacks"
    long_desc Help.text(:stacks)
    paging_options.call
    option :all_projects, desc: "Show all stacks across all projects", type: :boolean, default: false
    def perform
      name = Jets.project_name
      no_token_exit!
      params = paging_params.merge(options)
      resp = Jets::Api::Stack.list(params)
      check_for_error_message!(resp)

      data = resp["data"]
      if data.empty?
        $stderr.puts "No stacks deployed yet: #{name}"
      else
        message = if options[:all_projects]
                    "Stacks for all projects:"
                  else
                    "Stacks for project: #{name}"
                  end
        $stderr.puts message
        show_items(data)
      end
    rescue Jets::Api::RequestError => e
      puts "WARNING: Unable to list stacks. #{e.class}: #{e.message}"
    end

  private
    def show_items(items)
      presenter = CliFormat::Presenter.new
      presenter.header = ["Name"]
      items.each do |item|
        puts "#{item['name']} #{item['location']}"
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.12 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.11 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.10 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.9 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.8 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.7 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.6 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.5 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.4 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.3 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.2 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.1 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.0 lib/jets/commands/stacks/stacks_command.rb
jets-5.0.0.beta1 lib/jets/commands/stacks/stacks_command.rb