2086: def display_tasks_and_comments
2087: displayable_tasks = tasks.select { |t|
2088: t.comment && t.name =~ options.show_task_pattern
2089: }
2090: if options.full_description
2091: displayable_tasks.each do |t|
2092: puts "rake #{t.name_with_args}"
2093: t.full_comment.split("\n").each do |line|
2094: puts " #{line}"
2095: end
2096: puts
2097: end
2098: else
2099: width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10
2100: max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil
2101: displayable_tasks.each do |t|
2102: printf "#{name} %-#{width}s # %s\n",
2103: t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment
2104: end
2105: end
2106: end