Sha256: 2db468aaf664a8428f71eed83e0922a5c259f735d5a7403714d9d16e43c17495

Contents?: true

Size: 658 Bytes

Versions: 1

Compression:

Stored size: 658 Bytes

Contents

module CommandButler
  class LineDecorator
    def self.decoration(command:command, index:index, current_index: current_index, input: input)
      mark = if current_index == index
               "\e[33m" +  " > "
             elsif input
               "\e[32m" + (input.execute?? " o " : " - ")
             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

1 entries across 1 versions & 1 rubygems

Version Path
command_butler-0.0.1 lib/command_butler/line_decorator.rb