Skip to content
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/admin/delete_crate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
}
println!();

if !opts.yes && !dialoguer::confirm("Do you want to permanently delete these crates?") {
if !opts.yes && !dialoguer::confirm("Do you want to permanently delete these crates?")? {
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion src/admin/delete_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
}
println!();

if !opts.yes && !dialoguer::confirm("Do you want to permanently delete these versions?") {
if !opts.yes && !dialoguer::confirm("Do you want to permanently delete these versions?")? {
return Ok(());
}

Expand Down
3 changes: 1 addition & 2 deletions src/admin/dialoguer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use ::dialoguer::{theme::Theme, Confirm};

pub fn confirm(msg: &str) -> bool {
pub fn confirm(msg: &str) -> dialoguer::Result<bool> {
Confirm::with_theme(&CustomTheme)
.with_prompt(msg)
.default(false)
.wait_for_newline(true)
.interact()
.unwrap()
}

#[derive(Debug, Copy, Clone)]
Expand Down
6 changes: 3 additions & 3 deletions src/admin/transfer_crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn transfer(opts: Opts, conn: &mut PgConnection) -> anyhow::Result<()> {
println!("from: {:?}", from.gh_id);
println!("to: {:?}", to.gh_id);

if !dialoguer::confirm("continue?") {
if !dialoguer::confirm("continue?")? {
return Ok(());
}
}
Expand All @@ -56,7 +56,7 @@ fn transfer(opts: Opts, conn: &mut PgConnection) -> anyhow::Result<()> {
"Are you sure you want to transfer crates from {} to {}?",
from.gh_login, to.gh_login
);
if !dialoguer::confirm(&prompt) {
if !dialoguer::confirm(&prompt)? {
return Ok(());
}

Expand All @@ -74,7 +74,7 @@ fn transfer(opts: Opts, conn: &mut PgConnection) -> anyhow::Result<()> {
}
}

if !dialoguer::confirm("commit?") {
if !dialoguer::confirm("commit?")? {
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion src/admin/upload_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {

let files = repo.get_files_modified_since(opts.incremental_commit.as_deref())?;
println!("found {} files to upload", files.len());
if !dialoguer::confirm("continue with upload?") {
if !dialoguer::confirm("continue with upload?")? {
return Ok(());
}

Expand Down
2 changes: 1 addition & 1 deletion src/admin/yank_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn yank(opts: Opts, conn: &mut PgConnection) -> anyhow::Result<()> {
"Are you sure you want to yank {crate_name}#{version} ({})?",
v.id
);
if !dialoguer::confirm(&prompt) {
if !dialoguer::confirm(&prompt)? {
return Ok(());
}
}
Expand Down