lib/ginbin/menu.rb in ginbin-0.1.0 vs lib/ginbin/menu.rb in ginbin-1.0.0

- old
+ new

@@ -1,23 +1,27 @@ require "tty-prompt" -require_relative "commands" +require_relative "items" +require_relative "items_from_config" module Ginbin class Menu + attr_reader :title + + def initialize(items: ItemsFromConfig.new, title: "Root") + @items = items + @title = title + end + def call prompt = TTY::Prompt.new - prompt.enum_select("Select an editor?", choices).call + prompt.enum_select("Choose command", choices).call end def choices - commands.map do |command| + Items.new(@items).map do |command| { name: command.title, value: command } end - end - - def commands - Commands.new end end end