Sha256: 0d58bb6521255ce0061b13e38708b6b418aa37c75cc668e9fad23b5c08a96534

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

# Monkeypatch `todo-txt-gem` to create ANSI decorated terminal output.
class Todo::Task
  def to_s
    pastel = Pastel.new
    if done?
      pastel.strikethrough(super)
    else
      print_open_task(pastel)
    end
  end

  private

  def print_open_task(pastel)
    [
      pastel.red(print_priority),
      pastel.yellow(created_on.to_s),
      text,
      pastel.bold.magenta(print_contexts),
      pastel.bold.blue(print_projects),
      pastel.bold.cyan(print_tags)
    ].reject { |item| !item || item.nil? || item.empty? }.join(' ')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
intent-0.5.1 lib/gem_ext/todo-txt.rb
intent-0.5.0 lib/gem_ext/todo-txt.rb