Class: TerminalPresenter
- Inherits:
-
Object
- Object
- TerminalPresenter
- Defined in:
- lib/taf/terminal_presenter.rb
Overview
Handles terminal display formatting for items
Constant Summary collapse
- TAG_PREFIX =
Display format constants
"#".freeze
- TODO_PREFIX =
"- [ ]".freeze
- DONE_PREFIX =
"- [x]".freeze
- INDENT_SIZE =
2
Instance Method Summary collapse
Instance Method Details
#display_tag(tag) ⇒ Object
12 13 14 |
# File 'lib/taf/terminal_presenter.rb', line 12 def display_tag(tag) puts "#{TAG_PREFIX} #{tag}".red end |
#display_todo(todo, indent_level, highlighted: false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/taf/terminal_presenter.rb', line 16 def display_todo(todo, indent_level, highlighted: false) # Add indentation based on tree depth indent = ' ' * (indent_level * INDENT_SIZE) prefix = case todo.status when "done" DONE_PREFIX.grey when "todo" TODO_PREFIX.default end text_colored = todo.status == "done" ? todo.text.grey : todo.text.default line_number = "[#{todo.idx}]".cyan indicator = highlighted ? " ✔".green : "" puts indent + [prefix, text_colored, line_number + indicator].join(" ") end |