Class: CommandButler::LineDetailDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/command_butler/line_detail_decorator.rb

Class Method Summary collapse

Class Method Details

.decoration(command: command) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/command_butler/line_detail_decorator.rb', line 3

def self.decoration(command:command)
  res = ""
  res += " note: #{command.params["description"]}\n" unless command.params["description"].nil?
  res += " original : #{command.original_command} " if command.replaced?

  command.params.each_pair do |k,v|
    next if %w(chdir description original_command command need_confirm).include? k
    next if v.nil?
    res += " / "if 0 < res.size
    res += " #{k}: #{v.nil?? '-' : v}"
  end
  res = "       " + res if 0 < res.size
  "\e[34m" + res + "\e[0m"
end