feat: added --help description, added check for flag used without -s or --recursive and show warning
This commit is contained in:
parent
573bb9b393
commit
2b7af194d7
3 changed files with 15 additions and 4 deletions
|
@ -267,10 +267,18 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
|||
removing_optdepends = remove_notify_needed_optdepends(handle, trans->remove);
|
||||
}
|
||||
|
||||
if (trans->flags & ALPM_TRANS_FLAG_KEEPOPTIONALS && removing_optdepends == 1) {
|
||||
/* -Rks or Rsk == -Rs then -Rk */
|
||||
if (trans->flags & ALPM_TRANS_FLAG_RECURSE
|
||||
&& trans->flags & ALPM_TRANS_FLAG_KEEPOPTIONALS
|
||||
&& removing_optdepends == 1) {
|
||||
RET_ERR(handle, ALPM_ERR_REMOVING_OPTDEPENDS_DEPS, -1);
|
||||
}
|
||||
|
||||
if (!(trans->flags & ALPM_TRANS_FLAG_RECURSE)
|
||||
&& trans->flags & ALPM_TRANS_FLAG_KEEPOPTIONALS) {
|
||||
_alpm_log(handle, ALPM_LOG_WARNING, _("-k is set without -s or --recursive, ignoring flag...\n"));
|
||||
}
|
||||
|
||||
if(!(trans->flags & ALPM_TRANS_FLAG_NODEPS)) {
|
||||
event.type = ALPM_EVENT_CHECKDEPS_DONE;
|
||||
EVENT(handle, &event);
|
||||
|
|
|
@ -209,6 +209,7 @@ enum {
|
|||
OP_UPGRADES,
|
||||
OP_SYSUPGRADE,
|
||||
OP_UNNEEDED,
|
||||
OP_KEEPOPTDEP,
|
||||
OP_VERBOSE,
|
||||
OP_DOWNLOADONLY,
|
||||
OP_REFRESH,
|
||||
|
|
|
@ -126,6 +126,8 @@ static void usage(int op, const char * const myname)
|
|||
addlist(_(" -n, --nosave remove configuration files\n"));
|
||||
addlist(_(" -s, --recursive remove unnecessary dependencies\n"
|
||||
" (-ss includes explicitly installed dependencies)\n"));
|
||||
addlist(_(" -k, --keepoptdep keep the packages flagged as optdepends by other packages\n"
|
||||
" (only applied when using -s or --recursive)\n"));
|
||||
addlist(_(" -u, --unneeded remove unneeded packages\n"));
|
||||
} else if(op == PM_OP_UPGRADE) {
|
||||
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
|
||||
|
@ -729,10 +731,9 @@ static int parsearg_remove(int opt)
|
|||
case 'u':
|
||||
config->flags |= ALPM_TRANS_FLAG_UNNEEDED;
|
||||
break;
|
||||
case OP_KEEPOPTDEP:
|
||||
case 'k':
|
||||
if (config->flags & ALPM_TRANS_FLAG_RECURSE || config->flags & ALPM_TRANS_FLAG_RECURSEALL) {
|
||||
config->flags |= ALPM_TRANS_FLAG_KEEPOPTIONALS;
|
||||
}
|
||||
config->flags |= ALPM_TRANS_FLAG_KEEPOPTIONALS;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
|
@ -959,6 +960,7 @@ static int parseargs(int argc, char *argv[])
|
|||
{"upgrades", no_argument, 0, OP_UPGRADES},
|
||||
{"sysupgrade", no_argument, 0, OP_SYSUPGRADE},
|
||||
{"unneeded", no_argument, 0, OP_UNNEEDED},
|
||||
{"keepoptdep", no_argument, 0, OP_KEEPOPTDEP},
|
||||
{"verbose", no_argument, 0, OP_VERBOSE},
|
||||
{"downloadonly", no_argument, 0, OP_DOWNLOADONLY},
|
||||
{"refresh", no_argument, 0, OP_REFRESH},
|
||||
|
|
Loading…
Add table
Reference in a new issue