client: exit with error on errors
All checks were successful
Build and test / check (push) Successful in 1m44s
Build and test / check-license (push) Successful in 2m0s
Build and test / build (push) Successful in 2m55s
Build and test / test (push) Successful in 3m4s
Build and test / docs (push) Successful in 6m54s

This commit is contained in:
2025-12-16 13:46:17 +09:00
parent 40ce292083
commit 795c6d3c9d
12 changed files with 39 additions and 15 deletions

View File

@@ -63,5 +63,9 @@ pub async fn check_authorization(
print_check_authorization_output_status(&result); print_check_authorization_output_status(&result);
} }
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -60,5 +60,9 @@ pub async fn create_databases(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -107,5 +107,9 @@ pub async fn create_users(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -86,5 +86,9 @@ pub async fn drop_databases(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -90,5 +90,9 @@ pub async fn drop_users(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -291,6 +291,10 @@ pub async fn edit_database_privileges(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -67,5 +67,9 @@ pub async fn lock_users(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|res| res.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -116,5 +116,9 @@ pub async fn passwd_user(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.is_err() {
std::process::exit(1);
}
Ok(()) Ok(())
} }

View File

@@ -26,10 +26,6 @@ pub struct ShowDbArgs {
/// Print the information as JSON /// Print the information as JSON
#[arg(short, long)] #[arg(short, long)]
json: bool, json: bool,
/// Return a non-zero exit code if any of the results were erroneous
#[arg(short, long)]
fail: bool,
} }
pub async fn show_databases( pub async fn show_databases(
@@ -80,7 +76,7 @@ pub async fn show_databases(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if args.fail && databases.values().any(|res| res.is_err()) { if databases.values().any(|res| res.is_err()) {
std::process::exit(1); std::process::exit(1);
} }

View File

@@ -33,10 +33,6 @@ pub struct ShowPrivsArgs {
/// This flag has no effect when used with --json /// This flag has no effect when used with --json
#[arg(short, long)] #[arg(short, long)]
long: bool, long: bool,
/// Return a non-zero exit code if any of the results were erroneous
#[arg(short, long)]
fail: bool,
} }
pub async fn show_database_privileges( pub async fn show_database_privileges(
@@ -88,7 +84,7 @@ pub async fn show_database_privileges(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if args.fail && privilege_data.values().any(|res| res.is_err()) { if privilege_data.values().any(|res| res.is_err()) {
std::process::exit(1); std::process::exit(1);
} }

View File

@@ -26,10 +26,6 @@ pub struct ShowUserArgs {
/// Print the information as JSON /// Print the information as JSON
#[arg(short, long)] #[arg(short, long)]
json: bool, json: bool,
/// Return a non-zero exit code if any of the results were erroneous
#[arg(short, long)]
fail: bool,
} }
pub async fn show_users( pub async fn show_users(
@@ -83,7 +79,7 @@ pub async fn show_users(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if args.fail && users.values().any(|result| result.is_err()) { if users.values().any(|result| result.is_err()) {
std::process::exit(1); std::process::exit(1);
} }

View File

@@ -67,5 +67,9 @@ pub async fn unlock_users(
server_connection.send(Request::Exit).await?; server_connection.send(Request::Exit).await?;
if result.values().any(|result| result.is_err()) {
std::process::exit(1);
}
Ok(()) Ok(())
} }