Sha256: b3ae0b1671c6ee047a18745b96450c41e343befaf2673d6c89eb0f8f5364a6b9

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module Command
  class OpenConsole < Base
    NAME = "open-console"
    OPTIONS = [
      app_option(required: true),
      workload_option
    ].freeze
    DESCRIPTION = "Opens the app console on Control Plane in the default browser"
    LONG_DESCRIPTION = <<~DESC
      - Opens the app console on Control Plane in the default browser
      - Can also go directly to a workload page if `--workload` is provided
    DESC

    def call
      workload = config.options[:workload]
      url = "https://console.cpln.io/console/org/#{config.org}/gvc/#{config.app}"
      url += "/workload/#{workload}" if workload
      url += "/-info"
      opener = Shell.cmd("which", "xdg-open", "open")[:output].split("\n").grep_v("not found").first

      Kernel.exec(opener, url)
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
cpflow-4.0.1 lib/command/open_console.rb
cpflow-4.0.0 lib/command/open_console.rb
cpflow-3.0.1 lib/command/open_console.rb
cpflow-3.0.0 lib/command/open_console.rb
cpl-2.2.4 lib/command/open_console.rb
cpl-2.2.2 lib/command/open_console.rb
cpl-2.2.1 lib/command/open_console.rb
cpl-2.2.0 lib/command/open_console.rb