Class: KStarter::Commands::Command
- Inherits:
-
Object
- Object
- KStarter::Commands::Command
- Extended by:
- Forwardable
- Includes:
- TtyHelpers
- Defined in:
- lib/k_starter/commands/command.rb
Overview
Base command class
Direct Known Subclasses
BootstrapProject, ConfigurationMenu, EditProject, NewProject, ProjectMenu, SelectNewProjectType
Instance Attribute Summary collapse
-
#escape_pressed ⇒ Object
readonly
Returns the value of attribute escape_pressed.
Instance Method Summary collapse
- #ask_questions(form_type, form_variant = nil, **data) ⇒ Object
- #display_exiting_projects ⇒ Object
-
#execute ⇒ Object
Execute this command.
- #select_project ⇒ Object
Methods included from TtyHelpers
#command, #config, #cursor, #editor, #exec_exist?, #generator, #pager, #platform, #prompt, #screen, #which
Instance Attribute Details
#escape_pressed ⇒ Object (readonly)
Returns the value of attribute escape_pressed.
14 15 16 |
# File 'lib/k_starter/commands/command.rb', line 14 def escape_pressed @escape_pressed end |
Instance Method Details
#ask_questions(form_type, form_variant = nil, **data) ⇒ Object
26 27 28 |
# File 'lib/k_starter/commands/command.rb', line 26 def ask_questions(form_type, form_variant = nil, **data) KStarter::Questions::AskQuestions.for(form_type, form_variant, **data) end |
#display_exiting_projects ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/k_starter/commands/command.rb', line 30 def display_exiting_projects columns = %w[Name Type Path Description] rows = App.project.project_list.map do |project| [ project.name, project.type, project.variant, project.root_path, project.description ] end table = TTY::Table.new(columns, rows) puts table.render(:unicode) prompt.warn('-' * 100) end |
#execute ⇒ Object
Execute this command
19 20 21 22 23 24 |
# File 'lib/k_starter/commands/command.rb', line 19 def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end |