Class: Extension::Forms::Questions::AskName

Inherits:
Object
  • Object
show all
Includes:
ShopifyCLI::MethodObject
Defined in:
lib/project_types/extension/forms/questions/ask_name.rb

Instance Method Summary collapse

Methods included from ShopifyCLI::MethodObject

included, #to_proc

Instance Method Details

#call(project_details) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/project_types/extension/forms/questions/ask_name.rb', line 13

def call(project_details)
  if theme_app_extension?(project_details)
    project_details.name = name || "theme-app-extension"
  else
    project_details.name = ask_with_reprompt(
      initial_value: name,
      break_condition: -> (current_name) { Models::Registration.valid_title?(current_name) },
      prompt_message: ctx.message("create.ask_name"),
      reprompt_message: ctx.message("create.invalid_name", Models::Registration::MAX_TITLE_LENGTH)
    )
  end
  project_details
end