Class: KStarter::Commands::NewProject
- Defined in:
- lib/k_starter/commands/project/new_project.rb
Overview
Command Name goes here
Instance Attribute Summary collapse
-
#form_type ⇒ Object
readonly
Returns the value of attribute form_type.
-
#form_variant ⇒ Object
readonly
Returns the value of attribute form_variant.
Attributes inherited from Command
Instance Method Summary collapse
- #execute(input: $stdin, output: $stdout) ⇒ Object
-
#initialize(form_type:, form_variant:) ⇒ NewProject
constructor
A new instance of NewProject.
Methods inherited from Command
#ask_questions, #display_exiting_projects, #select_project
Methods included from TtyHelpers
#command, #config, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Constructor Details
#initialize(form_type:, form_variant:) ⇒ NewProject
Returns a new instance of NewProject.
10 11 12 13 14 15 |
# File 'lib/k_starter/commands/project/new_project.rb', line 10 def initialize(form_type:, form_variant:) @form_type = form_type @form_variant = form_variant super() end |
Instance Attribute Details
#form_type ⇒ Object (readonly)
Returns the value of attribute form_type.
7 8 9 |
# File 'lib/k_starter/commands/project/new_project.rb', line 7 def form_type @form_type end |
#form_variant ⇒ Object (readonly)
Returns the value of attribute form_variant.
8 9 10 |
# File 'lib/k_starter/commands/project/new_project.rb', line 8 def form_variant @form_variant end |
Instance Method Details
#execute(input: $stdin, output: $stdout) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/k_starter/commands/project/new_project.rb', line 17 def execute(input: $stdin, output: $stdout) questions = ask_questions(form_type, form_variant) questions.ask_questions puts JSON.pretty_generate(questions.to_h) App.project.save_project(questions) rescue KStarter::EscapePressed prompt.warn 'Exiting without saving' end |