Class: KStarter::Commands::ConfigurationMenu

Inherits:
Command
  • Object
show all
Defined in:
lib/k_starter/commands/configuration/configuration_menu.rb

Overview

Submenu for configuration

Instance Attribute Summary

Attributes inherited from Command

#escape_pressed

Instance Method Summary collapse

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(subcommand, options) ⇒ ConfigurationMenu

Returns a new instance of ConfigurationMenu.



7
8
9
10
11
12
# File 'lib/k_starter/commands/configuration/configuration_menu.rb', line 7

def initialize(subcommand, options)
  @subcommand = (subcommand || '').to_sym

  @options = options
  super()
end

Instance Method Details

#execute(input: $stdin, output: $stdout) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/k_starter/commands/configuration/configuration_menu.rb', line 14

def execute(input: $stdin, output: $stdout)
  command = nil
  case @subcommand
  when :menu
    menu
  when :open_config
    editor.open(App.config.filename)
    menu
  when :open_project
    editor.open(App.project.filename)
    menu
  end
  command&.execute(input: input, output: output) if command
end