Class: KuberKit::UI::Interactive

Inherits:
Object
  • Object
show all
Defined in:
lib/kuber_kit/ui/interactive.rb

Defined Under Namespace

Classes: TaskGroup

Instance Method Summary collapse

Instance Method Details

#create_task(title, &block) ⇒ Object



12
13
14
15
# File 'lib/kuber_kit/ui/interactive.rb', line 12

def create_task(title, &block)
  init_if_needed
  CLI::UI::Spinner.spin(title, &block)
end

#create_task_groupObject



7
8
9
10
# File 'lib/kuber_kit/ui/interactive.rb', line 7

def create_task_group
  init_if_needed
  TaskGroup.new
end


21
22
23
# File 'lib/kuber_kit/ui/interactive.rb', line 21

def print_error(title, text)
  print_in_frame(title, text, color: :red)
end


17
18
19
# File 'lib/kuber_kit/ui/interactive.rb', line 17

def print_info(title, text)
  print_in_frame(title, text, color: :blue)
end


25
26
27
# File 'lib/kuber_kit/ui/interactive.rb', line 25

def print_warning(title, text)
  print_in_frame(title, text, color: :yellow)
end

#prompt(text, options, &callback) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/kuber_kit/ui/interactive.rb', line 29

def prompt(text, options, &callback)
  CLI::UI::Prompt.ask(text) do |handler|
    options.each do |option|
      handler.option(option, &callback)
    end
  end
end