Sha256: 99fa7cc57c1c120b4576bfa518b09bc08731d6f2aca81bc1ac0838b24ef08b74

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module Command
  class Ps < Base
    NAME = "ps"
    OPTIONS = [
      app_option(required: true),
      location_option,
      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.
      cpflow ps -a $APP_NAME

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

    def call
      cp.fetch_gvc!

      location = config.location

      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.fetch_workload_replicas(workload, location: location)
        result["items"].each { |replica| puts replica }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cpflow-4.0.1 lib/command/ps.rb
cpflow-4.0.0 lib/command/ps.rb
cpflow-3.0.1 lib/command/ps.rb
cpflow-3.0.0 lib/command/ps.rb