Sha256: 2432ef44b0c8cac12d65a9c60d9eedc1cdbb4cb56211738cf2d5dd68d9347389

Contents?: true

Size: 751 Bytes

Versions: 15

Compression:

Stored size: 751 Bytes

Contents

module Jets::Command
  class ProjectsCommand < Base # :nodoc:
    desc "projects", "List deployed projects"
    long_desc Help.text(:projects)
    paging_options.call
    def perform
      no_token_exit!
      resp = Jets::Api::Project.list(paging_params)
      check_for_error_message!(resp)

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

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