Print file names with status.
(
&self,
file_diffs: &[FileDiff],
config: &DiffOutputConfig,
)
| 450 | |
| 451 | /// Print file names with status. |
| 452 | pub(super) fn print_name_status( |
| 453 | &self, |
| 454 | file_diffs: &[FileDiff], |
| 455 | config: &DiffOutputConfig, |
| 456 | ) -> CliResult<()> { |
| 457 | for file_diff in file_diffs { |
| 458 | let status_char = file_diff.status.status_char(); |
| 459 | let path = file_diff.display_path(); |
| 460 | |
| 461 | if config.color { |
| 462 | let status_str = status_char.to_string(); |
| 463 | let styled_status = match file_diff.status { |
| 464 | FileChangeStatus::Added => added(&status_str), |
| 465 | FileChangeStatus::Deleted => deleted(&status_str), |
| 466 | FileChangeStatus::Modified => modified(&status_str), |
| 467 | _ => info(&status_str), |
| 468 | }; |
| 469 | println!("{} {}", styled_status, style_path(path)); |
| 470 | } else { |
| 471 | println!("{} {}", status_char, path); |
| 472 | } |
| 473 | } |
| 474 | Ok(()) |
| 475 | } |
| 476 | } |
no test coverage detected