Skip to content

Commit

Permalink
boulder/analysis: Add new ReplaceFile enum option in Decision
Browse files Browse the repository at this point in the history
  • Loading branch information
joebonrichie committed Jul 18, 2024
1 parent fc70724 commit 6e3a142
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion boulder/src/package/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'a> Chain<'a> {
}

pub fn process(&mut self, paths: impl IntoIterator<Item = PathInfo>) -> Result<(), BoxError> {
println!("│Analyzing artefacts (» = Include, × = Ignore)");
println!("│Analyzing artefacts (» = Include, × = Ignore, ^ = Replace)");

let mut queue = paths.into_iter().collect::<VecDeque<_>>();

Expand Down Expand Up @@ -107,6 +107,18 @@ impl<'a> Chain<'a> {
bucket.paths.push(path);
continue 'paths;
}
Decision::ReplaceFile { newpath } => {
let newpathinfo = self.collector.path(&newpath, self.hasher)?;
pb.println(format!(
"│A{} {} » {}",
"│ ^".dark_magenta(),
format!("{}", path.target_path.display()).dim(),
newpathinfo.target_path.display()
));
pb.inc(1);
bucket.paths.push(newpathinfo);
continue 'paths;
}
}
}
}
Expand Down Expand Up @@ -155,6 +167,7 @@ pub enum Decision {
NextHandler,
IgnoreFile { reason: String },
IncludeFile,
ReplaceFile { newpath: PathBuf },
}

impl From<Decision> for Response {
Expand Down

0 comments on commit 6e3a142

Please sign in to comment.