Sha256: 530be93508c6cfa6690094578514054a5305fa63bd1db2de341c896e01883ae4

Contents?: true

Size: 967 Bytes

Versions: 13

Compression:

Stored size: 967 Bytes

Contents

# frozen_string_literal: true

module Command
  class Ps < Base
    NAME = "ps"
    OPTIONS = [
      app_option(required: true),
      workload_option
    ].freeze
    DESCRIPTION = "Shows running replicas in app"
    LONG_DESCRIPTION = <<~DESC
      - Shows running replicas in app
    DESC
    EXAMPLES = <<~EX
      ```sh
      # Shows running replicas in app, for all workloads.
      cpl ps -a $APP_NAME

      # Shows running replicas in app, for a specific workload.
      cpl ps -a $APP_NAME -w $WORKLOAD_NAME
      ```
    EX

    def call
      cp.fetch_gvc!

      workloads = [config.options[:workload]] if config.options[:workload]
      workloads ||= config[:app_workloads] + config[:additional_workloads]
      workloads.each do |workload|
        cp.fetch_workload!(workload)

        result = cp.workload_get_replicas(workload, location: config[:default_location])
        result["items"].each { |replica| puts replica }
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cpl-1.1.2 lib/command/ps.rb
cpl-1.1.2.rc.0 lib/command/ps.rb
cpl-1.1.1 lib/command/ps.rb
cpl-1.1.0 lib/command/ps.rb
cpl-1.0.4 lib/command/ps.rb
cpl-1.0.3 lib/command/ps.rb
cpl-1.0.2 lib/command/ps.rb
cpl-1.0.1 lib/command/ps.rb
cpl-1.0.0 lib/command/ps.rb
cpl-0.7.0 lib/command/ps.rb
cpl-0.6.0 lib/command/ps.rb
cpl-0.5.1 lib/command/ps.rb
cpl-0.5.0 lib/command/ps.rb