Simple tool for automatic file management

ft: print information that this is dry run

hauleth.dev 8129cf8d e9be82be

verified
Changed files
+9 -3
cli
+2 -2
cli/src/filters.rs
···
impl Filter for Magic {
async fn matches(&self, file: &Path) -> bool {
match *self {
-
Magic::Magic { ref bytes, offset } => read_first_bytes(bytes.len(), file, offset)
+
Self::Magic { ref bytes, offset } => read_first_bytes(bytes.len(), file, offset)
.await
.map(|read| read == *bytes)
.unwrap_or(false),
-
Magic::Mime(ref mime_type) => guess_mime(file)
+
Self::Mime(ref mime_type) => guess_mime(file)
.await
.map(|typ| typ.mime_type() == mime_type)
.unwrap_or(false),
+7 -1
cli/src/main.rs
···
.try_collect()
.await?;
+
if !args.execute {
+
println!("Dry run, to apply changes run with flag `-!`\n");
+
}
+
+
//let out =
stream::iter(tasks)
.flatten()
-
.for_each_concurrent(None, |(action, path)| action.run(path, args.execute))
+
.then(|(action, path)| action.run(path, args.execute))
+
.count()
.await;
Ok(())