Sha256: 878bd5ae83aa267c20a23642d89bed93ae4ae6ee16b80201b345bdad27fb4816
Contents?: true
Size: 880 Bytes
Versions: 16
Compression:
Stored size: 880 Bytes
Contents
# frozen_string_literal: true module Command class Open < Base NAME = "open" OPTIONS = [ app_option(required: true), workload_option ].freeze DESCRIPTION = "Opens the app endpoint URL in the default browser" LONG_DESCRIPTION = <<~DESC - Opens the app endpoint URL in the default browser DESC EXAMPLES = <<~EX ```sh # Opens the endpoint of the default workload (`one_off_workload`). cpl open -a $APP_NAME # Opens the endpoint of a specific workload. cpl open -a $APP_NAME -w $WORKLOAD_NAME ``` EX def call workload = config.options[:workload] || config[:one_off_workload] data = cp.fetch_workload!(workload) url = data["status"]["endpoint"] opener = `which xdg-open open`.split("\n").grep_v("not found").first exec %(#{opener} "#{url}") end end end
Version data entries
16 entries across 16 versions & 1 rubygems