Sha256: 5f8a29a2b48805346774792d38306738cf00e3e797e04bb0200b5a0af0f37f55
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require 'forwardable' module KStarter module Commands # Base command class class Command extend Forwardable include TtyHelpers def_delegators :command, :run attr_reader :escape_pressed # Execute this command # # @api public def execute(*) raise( NotImplementedError, "#{self.class}##{__method__} must be implemented" ) end def ask_questions(form_type, form_variant = nil, **data) KStarter::Questions::AskQuestions.for(form_type, form_variant, **data) end 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 def select_project choices = App.project.project_list.map(&:name) name = prompt.select('Select a project?', choices, cycle: true) App.project.find_project(name) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems