Skip to content

Commit

Permalink
♻️ use OutputOption to extract_entry argument to simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Aug 24, 2024
1 parent 64a64c8 commit 940a55d
Showing 1 changed file with 10 additions and 25 deletions.
35 changes: 10 additions & 25 deletions cli/src/command/extract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,19 +167,10 @@ where
}
let tx = tx.clone();
let password = password.clone();
let out_dir = args.out_dir.clone();
let owner_options = args.owner_options.clone();
let options = args.clone();
pool.spawn_fifo(move || {
tx.send(extract_entry(
item,
password,
args.overwrite,
out_dir.as_deref(),
args.keep_options,
owner_options,
verbosity,
))
.unwrap_or_else(|e| panic!("{e}: {}", item_path));
tx.send(extract_entry(item, password, options, verbosity))
.unwrap_or_else(|e| panic!("{e}: {}", item_path));
});
Ok(())
})?;
Expand All @@ -189,26 +180,20 @@ where
}

for item in hard_link_entries {
extract_entry(
item,
password.clone(),
args.overwrite,
args.out_dir.as_deref(),
args.keep_options,
args.owner_options.clone(),
verbosity,
)?;
extract_entry(item, password.clone(), args.clone(), verbosity)?;
}
Ok(())
}

pub(crate) fn extract_entry(
item: RegularEntry,
password: Option<String>,
overwrite: bool,
out_dir: Option<&Path>,
keep_options: KeepOptions,
owner_options: OwnerOptions,
OutputOption {
overwrite,
out_dir,
keep_options,
owner_options,
}: OutputOption,
verbosity: Verbosity,
) -> io::Result<()> {
let item_path = item.header().path().as_path();
Expand Down

0 comments on commit 940a55d

Please sign in to comment.