2121: def display_tasks_and_comments
2122: displayable_tasks = tasks.select { |t|
2123: t.comment && t.name =~ options.show_task_pattern
2124: }
2125: if options.full_description
2126: displayable_tasks.each do |t|
2127: puts "#{name} #{t.name_with_args}"
2128: t.full_comment.split("\n").each do |line|
2129: puts " #{line}"
2130: end
2131: puts
2132: end
2133: else
2134: width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
2135: max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
2136: displayable_tasks.each do |t|
2137: printf "#{name} %-#{width}s # %s\n",
2138: t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
2139: end
2140: end
2141: end