Sha256: 23fa155532708e932b74cedc7c22bb99350d559b2b5268d7ae285cd9025b9028
Contents?: true
Size: 493 Bytes
Versions: 2
Compression:
Stored size: 493 Bytes
Contents
require "tty-prompt" 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("Choose command", choices).call end def choices Items.new(@items).map do |command| { name: command.title, value: command } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ginbin-1.0.1 | lib/ginbin/menu.rb |
ginbin-1.0.0 | lib/ginbin/menu.rb |