list: use `apk list --providers` to search virtual providers instead of enabling virtuals by default

cute-signatures
William Pitcock 2018-01-29 03:17:07 +00:00
parent d379edd5bf
commit d52285c9aa
1 changed files with 8 additions and 6 deletions

View File

@ -26,7 +26,7 @@ struct list_ctx {
unsigned int upgradable : 1;
unsigned int match_origin : 1;
unsigned int match_depends : 1;
unsigned int match_real_names : 1;
unsigned int match_providers : 1;
struct apk_string_array *filters;
};
@ -153,9 +153,12 @@ static void iterate_providers(const struct apk_name *name, const struct list_ctx
foreach_array_item(p, name->providers)
{
if (ctx->match_real_names && p->pkg->name != name)
if (!ctx->match_providers && p->pkg->name != name)
continue;
if (ctx->match_providers)
printf("<%s> ", name->name);
filter_package(p->pkg, ctx);
}
}
@ -206,10 +209,9 @@ static int option_parse_applet(void *pctx, struct apk_db_options *dbopts, int op
break;
case 'd':
ctx->match_depends = 1;
ctx->match_real_names = 1;
break;
case 'r':
ctx->match_real_names = 1;
case 'P':
ctx->match_providers = 1;
break;
default:
return -1;
@ -225,7 +227,7 @@ static const struct apk_option options_applet[] = {
{ 'u', "upgradable", "List upgradable packages only" },
{ 'o', "origin", "List packages by origin" },
{ 'd', "depends", "List packages by dependency" },
{ 'r', "real-names", "List packages by real names only" },
{ 'P', "providers", "List packages by provider" },
};
static const struct apk_option_group optgroup_applet = {