Module: RubyTodo::TemplateDisplay
- Included in:
- TemplateCommands
- Defined in:
- lib/ruby_todo/commands/template_commands.rb
Instance Method Summary collapse
Instance Method Details
#display_template_details(template) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ruby_todo/commands/template_commands.rb', line 28 def display_template_details(template) puts "Template Details:" puts "ID: #{template.id}" puts "Name: #{template.name}" puts "Notebook: #{template.notebook&.name || "None"}" puts "Title Pattern: #{template.title_pattern}" puts "Description Pattern: #{template.description_pattern || "None"}" puts "Tags Pattern: #{template.tags_pattern || "None"}" puts "Priority: #{template.priority || "None"}" puts "Due Date Offset: #{template.due_date_offset || "None"}" puts "Created At: #{template.created_at}" puts "Updated At: #{template.updated_at}" end |
#display_template_list(templates) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ruby_todo/commands/template_commands.rb', line 5 def display_template_list(templates) if templates.empty? puts "No templates found. Create one with 'ruby_todo template create NAME'" return end table = TTY::Table.new( header: ["ID", "Name", "Title Pattern", "Notebook", "Priority", "Due Date Offset"], rows: templates.map do |template| [ template.id, template.name, template.title_pattern, template.notebook&.name || "None", template.priority || "None", template.due_date_offset || "None" ] end ) puts table.render(:unicode, padding: [0, 1]) end |