Sha256: c92110638b54cafebbcc77ac7e88cc05434eb2ea5eea3b472dbc56dcd97f1b27
Contents?: true
Size: 1.09 KB
Versions: 6
Compression:
Stored size: 1.09 KB
Contents
require 'cli/ui' class KuberKit::UI::Interactive class TaskGroup < CLI::UI::SpinGroup end def create_task_group init_if_needed TaskGroup.new end def create_task(title, &block) init_if_needed CLI::UI::Spinner.spin(title, &block) end def print_info(title, text) print_in_frame(title, text, color: :blue) end def print_error(title, text) print_in_frame(title, text, color: :red) end def print_warning(title, text) print_in_frame(title, text, color: :yellow) end def prompt(text, options, &callback) CLI::UI::Prompt.ask(text) do |handler| options.each do |option| if callback handler.option(option, &callback) else handler.option(option) do |selection| selection end end end end end private def init @initialized = true ::CLI::UI::StdoutRouter.enable end def init_if_needed init unless @initialized end def print_in_frame(title, text, color:) CLI::UI::Frame.open(title, color: color) do puts text end end end
Version data entries
6 entries across 6 versions & 1 rubygems