Sha256: 237fb4bc9142b840c420195845beccb53a29c6c793ca351ff73d62699bbf9f1c
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
module CommandButler class LineDecorator def self.decoration(command:command, index:index, current_index: current_index, history: history) mark = if current_index == index "\e[33m" + " > " elsif history if history[:result] history[:result][:status].success?? "\e[32m" + " o " : "\e[31m" + " x " else "\e[32m" + (history[:input].execute?? " o " : " - ") end else "\e[37m" + " " end ret = "#{index + 1} " + "["+ mark + "\e[0m" + "]" if command.command # コマンド ret += " " + command.command else ret += " - " end ret += " <= chdir to #{command.chdir}" if command.chdir # ディレクトリ移動 ret end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
command_butler-0.0.3 | lib/command_butler/line_decorator.rb |
command_butler-0.0.2 | lib/command_butler/line_decorator.rb |