diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-10-06 22:45:10 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-10-13 04:54:29 +0200 |
commit | 01beca5df717252c7c9aa59bc705dc10a25ebdc8 (patch) | |
tree | ef37062e577f2441cc04c66b7fa4f853d200c088 /src | |
parent | 7ddc967d7cf2b8de73095cb841ee2c5973a669e4 (diff) | |
download | pacman-01beca5df717252c7c9aa59bc705dc10a25ebdc8.tar.gz pacman-01beca5df717252c7c9aa59bc705dc10a25ebdc8.tar.xz |
pacman: add --confirm option
--confirm cancels the effect of a previous --noconfirm.
This makes it easier for scripts to default to --noconfirm
but allow users to override it.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/conf.h | 1 | ||||
-rw-r--r-- | src/pacman/pacman.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/pacman/conf.h b/src/pacman/conf.h index 8aed6d6b..3141e2c3 100644 --- a/src/pacman/conf.h +++ b/src/pacman/conf.h @@ -131,6 +131,7 @@ enum { enum { OP_LONG_FLAG_MIN = 1000, OP_NOCONFIRM, + OP_CONFIRM, OP_CONFIG, OP_IGNORE, OP_DEBUG, diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 5cac37ca..3d1406bb 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -205,6 +205,7 @@ static void usage(int op, const char * const myname) addlist(_(" --gpgdir <path> set an alternate home directory for GnuPG\n")); addlist(_(" --logfile <path> set an alternate log file\n")); addlist(_(" --noconfirm do not ask for any confirmation\n")); + addlist(_(" --confirm always ask for confirmation\n")); } list = alpm_list_msort(list, alpm_list_count(list), options_cmp); for(i = list; i; i = alpm_list_next(i)) { @@ -456,6 +457,9 @@ static int parsearg_global(int opt) case OP_NOCONFIRM: config->noconfirm = 1; break; + case OP_CONFIRM: + config->noconfirm = 0; + break; case OP_DBPATH: case 'b': free(config->dbpath); @@ -858,6 +862,7 @@ static int parseargs(int argc, char *argv[]) {"downloadonly", no_argument, 0, OP_DOWNLOADONLY}, {"refresh", no_argument, 0, OP_REFRESH}, {"noconfirm", no_argument, 0, OP_NOCONFIRM}, + {"confirm", no_argument, 0, OP_CONFIRM}, {"config", required_argument, 0, OP_CONFIG}, {"ignore", required_argument, 0, OP_IGNORE}, {"assume-installed", required_argument, 0, OP_ASSUMEINSTALLED}, |