Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return with exit code when --ask is not accepted #146

Merged
merged 2 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl NHRunnable for interface::CleanMode {
if args.ask {
info!("Confirm the cleanup plan?");
if !dialoguer::Confirm::new().default(false).interact()? {
return Ok(());
bail!("User rejected the cleanup plan");
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/home.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl HomeRebuildArgs {
let confirmation = dialoguer::Confirm::new().default(false).interact()?;

if !confirmation {
return Ok(());
bail!("User rejected the new config");
}
}

Expand All @@ -151,7 +151,8 @@ impl HomeRebuildArgs {
.build()?
.exec()?;

// Drop the out dir *only* when we are finished
// Make sure out_path is not accidentally dropped
// https://docs.rs/tempfile/3.12.0/tempfile/index.html#early-drop-pitfall
drop(out_path);

Ok(())
Expand Down
5 changes: 3 additions & 2 deletions src/nixos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl OsRebuildArgs {
let confirmation = dialoguer::Confirm::new().default(false).interact()?;

if !confirmation {
return Ok(());
bail!("User rejected the new config");
}
}

Expand Down Expand Up @@ -175,7 +175,8 @@ impl OsRebuildArgs {
.exec()?;
}

// Drop the out dir *only* when we are finished
// Make sure out_path is not accidentally dropped
// https://docs.rs/tempfile/3.12.0/tempfile/index.html#early-drop-pitfall
drop(out_path);

Ok(())
Expand Down