Sha256: d099db2ea51e222708590be3ea87b614313e7c2137d2f845c8a7e14b7d702a6b
Contents?: true
Size: 1.13 KB
Versions: 22
Compression:
Stored size: 1.13 KB
Contents
require "shopify_cli" module ShopifyCLI module CommandOptions module CommandServeOptions def self.included(base) base.extend(ClassMethods) base.class_eval do def port return ShopifyCLI::Tunnel::PORT.to_s unless options.flags.key?(:port) port = options.flags[:port].to_i @ctx.abort(@ctx.message("core.app.serve.error.invalid_port", options.flags[:port])) unless port > 0 port end def host host = options.flags[:host] unless host.nil? @ctx.abort(@ctx.message("core.app.serve.error.host_must_be_https")) if host.match(/^https/i).nil? end host end end end module ClassMethods def parse_host_option options do |parser, flags| parser.on("--host=HOST") do |h| flags[:host] = h.gsub('"', "") end end end def parse_port_option options do |parser, flags| parser.on("--port=PORT") { |port| flags[:port] = port } end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems