class Flow::Cli::Utils::CmdHelper

Attributes

prompt[RW]

Public Class Methods

instance() click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 51
def instance
  new
end
new() click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 9
def initialize
  @pastel = Pastel.new
  self.prompt = TTY::Prompt.new
end

Public Instance Methods

echo(log) click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 16
def echo(log)
  @green ||= @pastel.green.bold.detach
  puts @green.call log
end
echo_error(log)
Alias for: puts_error
echo_warning(log)
Alias for: puts_warning
error(log)
Alias for: puts_error
puts_error(log) click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 34
def puts_error(log)
  @error ||= @pastel.red.bold.detach
  puts @error.call(log)
end
Also aliased as: error, echo_error
puts_table(arr_dict, sorted_titles = nil) click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 21
def puts_table(arr_dict, sorted_titles = nil)
  sorted_titles = arr_dict.first.keys if sorted_titles.nil?
  table = TTY::Table.new header: sorted_titles
  arr_dict.each do |item| 
    show_item = []
    sorted_titles.each do |key|
      show_item << item[key]
    end
    table << show_item
  end
  puts table.render(:unicode)
end
puts_warning(log) click to toggle source
# File lib/flow/cli/utils/cmd_helper.rb, line 39
def puts_warning(log)
  @warning ||= @pastel.yellow.detach
  puts @warning.call(log)
end
Also aliased as: warning, echo_warning, warn
warn(log)
Alias for: puts_warning
warning(log)
Alias for: puts_warning