[pacman-dev] [PATCH] Give a "success!" message on database check

Patrick Eigensatz patrickeigensatz at gmail.com
Sun Sep 25 12:02:26 UTC 2016


'pacman -Dk' prints a "success!" message if there were no errors.
It is possible to suppress the output using the '-q / --quiet' flag.

This implements the feature discussed at https://bugs.archlinux.org/task/50087

Signed-off-by: Patrick Eigensatz <patrick.eigensatz at gmail.com>
---
 src/pacman/database.c | 4 ++++
 src/pacman/pacman.c   | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/pacman/database.c b/src/pacman/database.c
index 0197903..5143031 100644
--- a/src/pacman/database.c
+++ b/src/pacman/database.c
@@ -286,6 +286,10 @@ int pacman_database(alpm_list_t *targets)
 		} else {
 			ret = check_db_sync();
 		}
+
+		if(ret == 0 && !config->quiet) {
+			printf(_("success!\n"));
+		}
 	}
 
 	if(config->flags & (ALPM_TRANS_FLAG_ALLDEPS | ALPM_TRANS_FLAG_ALLEXPLICIT)) {
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index be52d1b..b477df7 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -466,6 +466,10 @@ static int parsearg_database(int opt)
 		case 'k':
 			(config->op_q_check)++;
 			break;
+		case OP_QUIET:
+		case 'q':
+			config->quiet = 1;
+		break;
 		default:
 			return 1;
 	}
-- 
2.10.0


More information about the pacman-dev mailing list