Rename Confirmer to UIThread

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-10 13:45:20 +10:00
parent 9349fbabdc
commit 88c3f15b3f
No known key found for this signature in database
GPG key ID: 591C0B03040416D6
3 changed files with 16 additions and 16 deletions

View file

@ -191,7 +191,7 @@ async fn entry() -> Result<()> {
)
.unwrap();
let mut confirmer = Confirmer::new(!opts.no_confirm);
let mut uithread = UIThread::new(!opts.no_confirm);
// Compute install directory
let install_path = get_install_path(opts.install_path.as_deref()).ok_or_else(|| {
@ -231,7 +231,7 @@ async fn entry() -> Result<()> {
);
if !opts.dry_run {
confirmer.confirm().await?;
uithread.confirm().await?;
}
}
@ -305,7 +305,7 @@ async fn entry() -> Result<()> {
opts,
package,
temp_dir,
&mut confirmer,
&mut uithread,
)
.await
}
@ -320,7 +320,7 @@ async fn entry() -> Result<()> {
.first()
.ok_or_else(|| miette!("No viable targets found, try with `--targets`"))?;
install_from_source(opts, package, target, &mut confirmer).await
install_from_source(opts, package, target, &mut uithread).await
}
}
}
@ -334,7 +334,7 @@ async fn install_from_package(
opts: Options,
package: Package<Meta>,
temp_dir: TempDir,
confirmer: &mut Confirmer,
uithread: &mut UIThread,
) -> Result<()> {
// Prompt user for third-party source
if fetcher.is_third_party() {
@ -343,7 +343,7 @@ async fn install_from_package(
fetcher.source_name()
);
if !opts.dry_run {
confirmer.confirm().await?;
uithread.confirm().await?;
}
} else {
info!(
@ -433,7 +433,7 @@ async fn install_from_package(
return Ok(());
}
confirmer.confirm().await?;
uithread.confirm().await?;
info!("Installing binaries...");
for file in &bin_files {
@ -462,12 +462,12 @@ async fn install_from_source(
opts: Options,
package: Package<Meta>,
target: &str,
confirmer: &mut Confirmer,
uithread: &mut UIThread,
) -> Result<()> {
// Prompt user for source install
warn!("The package will be installed from source (with cargo)",);
if !opts.dry_run {
confirmer.confirm().await?;
uithread.confirm().await?;
}
if opts.dry_run {