summaryrefslogtreecommitdiff
path: root/src/list.c
diff options
context:
space:
mode:
authorWilliam Pitcock <nenolod@dereferenced.org>2018-01-29 02:59:39 +0000
committerWilliam Pitcock <nenolod@dereferenced.org>2018-01-29 02:59:39 +0000
commit3334624cd1a33b2a3f22aaac275b334915ecc088 (patch)
tree2fcc0bfd2de5ad271fd0df39ec216425ed4aaa4a /src/list.c
parent368b8b672521ee3f001d074da5dec47273c87770 (diff)
downloadapk-tools-3334624cd1a33b2a3f22aaac275b334915ecc088.tar.gz
apk-tools-3334624cd1a33b2a3f22aaac275b334915ecc088.tar.bz2
apk-tools-3334624cd1a33b2a3f22aaac275b334915ecc088.tar.xz
apk-tools-3334624cd1a33b2a3f22aaac275b334915ecc088.zip
list: add option to match against real names only instead of providers
Diffstat (limited to 'src/list.c')
-rw-r--r--src/list.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/list.c b/src/list.c
index d4ee69a..1e61c37 100644
--- a/src/list.c
+++ b/src/list.c
@@ -26,6 +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;
struct apk_string_array *filters;
};
@@ -152,7 +153,7 @@ static void iterate_providers(const struct apk_name *name, const struct list_ctx
foreach_array_item(p, name->providers)
{
- if (p->pkg->name != name)
+ if (ctx->match_real_names && p->pkg->name != name)
continue;
filter_package(p->pkg, ctx);
@@ -205,6 +206,10 @@ 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;
break;
default:
return -1;
@@ -220,6 +225,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" },
};
static const struct apk_option_group optgroup_applet = {