Sha256: a5886696f1e47f32e93322e016cc50b9af63924a9302977354a43408acc81be7
Contents?: true
Size: 1.11 KB
Versions: 22
Compression:
Stored size: 1.11 KB
Contents
module Extension module Forms module Questions class AskTemplate include ShopifyCLI::MethodObject property! :ctx property :template, accepts: Models::ServerConfig::Development::VALID_TEMPLATES property :prompt, accepts: ->(prompt) { prompt.respond_to?(:call) }, default: -> { CLI::UI::Prompt.method(:ask) } def call(project_details) if template_required?(project_details) project_details.template = template || choose_interactively(project_details) end project_details end private def template_required?(project_details) type = project_details&.type&.identifier Models::DevelopmentServerRequirements.supported?(type) end def choose_interactively(project_details) prompt.call(ctx.message("create.ask_template")) do |handler| Models::ServerConfig::Development.find(project_details&.type&.identifier).each do |template| handler.option(template) { template } end end end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems