client: exit with error on errors
All checks were successful
All checks were successful
This commit is contained in:
@@ -63,5 +63,9 @@ pub async fn check_authorization(
|
||||
print_check_authorization_output_status(&result);
|
||||
}
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -60,5 +60,9 @@ pub async fn create_databases(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -107,5 +107,9 @@ pub async fn create_users(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -86,5 +86,9 @@ pub async fn drop_databases(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -90,5 +90,9 @@ pub async fn drop_users(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -291,6 +291,10 @@ pub async fn edit_database_privileges(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
@@ -67,5 +67,9 @@ pub async fn lock_users(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|res| res.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -116,5 +116,9 @@ pub async fn passwd_user(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.is_err() {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ pub struct ShowDbArgs {
|
||||
/// Print the information as JSON
|
||||
#[arg(short, long)]
|
||||
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(
|
||||
@@ -80,7 +76,7 @@ pub async fn show_databases(
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@ pub struct ShowPrivsArgs {
|
||||
/// This flag has no effect when used with --json
|
||||
#[arg(short, long)]
|
||||
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(
|
||||
@@ -88,7 +84,7 @@ pub async fn show_database_privileges(
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,6 @@ pub struct ShowUserArgs {
|
||||
/// Print the information as JSON
|
||||
#[arg(short, long)]
|
||||
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(
|
||||
@@ -83,7 +79,7 @@ pub async fn show_users(
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,5 +67,9 @@ pub async fn unlock_users(
|
||||
|
||||
server_connection.send(Request::Exit).await?;
|
||||
|
||||
if result.values().any(|result| result.is_err()) {
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user