dry4rust/cli/
ignored_command.rs1use std::io::Write;
7use std::path::Path;
8
9use crate::cli::cli_error::CliResult;
10use crate::cli::ignore_entry_line::IgnoreEntryLine;
11use crate::suppression::ignore_file::IgnoreFile;
12
13pub struct IgnoredCommand<'a> {
15 root: &'a Path,
16}
17
18impl<'a> IgnoredCommand<'a> {
19 #[must_use]
20 pub const fn new(root: &'a Path) -> Self {
21 Self { root }
22 }
23
24 pub fn run(&self, writer: &mut impl Write) -> CliResult {
30 let ignore_file = IgnoreFile::load(self.root);
31 if ignore_file.ignore.is_empty() {
32 writeln!(writer, "No ignored fingerprints.")?;
33 return Ok(());
34 }
35 writeln!(writer, "Ignored fingerprints:")?;
36 for entry in &ignore_file.ignore {
37 writeln!(writer, "{}", IgnoreEntryLine::new(entry))?;
38 }
39 Ok(())
40 }
41}