Sha256: ec1f4b99f218c42d3d5221bec90a113a2833cbd1d0e98f603e2f613d08c551df

Contents?: true

Size: 789 Bytes

Versions: 4

Compression:

Stored size: 789 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 = `which xdg-open open`.split("\n").grep_v("not found").first

      exec %(#{opener} "#{url}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cpl-1.4.0 lib/command/open_console.rb
cpl-1.3.0 lib/command/open_console.rb
cpl-1.2.0 lib/command/open_console.rb
cpl-1.1.2 lib/command/open_console.rb