Sha256: b9ddee55435196e8c83637b0581a40fcb6bc4be1e6a136bd433c095205780bdd
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require "uri" module Node module Forms class Create < ShopifyCli::Form attr_accessor :name flag_arguments :title, :organization_id, :shop_domain, :type def ask self.title ||= CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_name")) self.type = ask_type self.name = self.title.downcase.split(" ").join("_") res = ShopifyCli::Tasks::SelectOrgAndShop.call(ctx, organization_id: organization_id, shop_domain: shop_domain) self.organization_id = res[:organization_id] self.shop_domain = res[:shop_domain] end private def ask_type if type.nil? return CLI::UI::Prompt.ask(ctx.message("node.forms.create.app_type.select")) do |handler| handler.option(ctx.message("node.forms.create.app_type.select_public")) { "public" } handler.option(ctx.message("node.forms.create.app_type.select_custom")) { "custom" } end end unless ShopifyCli::Tasks::CreateApiClient::VALID_APP_TYPES.include?(type) ctx.abort(ctx.message("node.forms.create.error.invalid_app_type", type)) end ctx.puts(ctx.message("node.forms.create.app_type.selected", type)) type end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shopify-cli-1.7.1 | lib/project_types/node/forms/create.rb |
shopify-cli-1.7.0 | lib/project_types/node/forms/create.rb |