diff options
author | 2022-12-15 10:35:57 +0100 | |
---|---|---|
committer | 2022-12-15 10:35:57 +0100 | |
commit | 05e24fdd5fda7fdee37c7f48d398e15f3ba56514 (patch) | |
tree | d640e3b8d1bf2c6e308958722b7898717e06f53b | |
parent | qkeyword: gracefully handle case with no found arches (diff) | |
download | portage-utils-05e24fdd5fda7fdee37c7f48d398e15f3ba56514.tar.gz portage-utils-05e24fdd5fda7fdee37c7f48d398e15f3ba56514.tar.bz2 portage-utils-05e24fdd5fda7fdee37c7f48d398e15f3ba56514.zip |
qkeyword: add -A option to show the current arch
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rw-r--r-- | man/qkeyword.1 | 8 | ||||
-rw-r--r-- | qkeyword.c | 31 |
2 files changed, 26 insertions, 13 deletions
diff --git a/man/qkeyword.1 b/man/qkeyword.1 index 2c7eaf58..476a6fab 100644 --- a/man/qkeyword.1 +++ b/man/qkeyword.1 @@ -1,5 +1,5 @@ .\" generated by mkman.py, please do NOT edit! -.TH qkeyword "1" "Feb 2021" "Gentoo Foundation" "qkeyword" +.TH qkeyword "1" "Dec 2022" "Gentoo Foundation" "qkeyword" .SH NAME qkeyword \- list packages based on keywords .SH SYNOPSIS @@ -37,6 +37,9 @@ match catname. \fB\-m\fR \fI<arg>\fR, \fB\-\-matchmaint\fR \fI<arg>\fR match maintainer email from metadata.xml (slow). .TP +\fB\-A\fR, \fB\-\-showarch\fR +show selected arch from profile configuration. +.TP \fB\-i\fR, \fB\-\-imlate\fR list packages that can be marked stable for <arch>. .TP @@ -76,6 +79,9 @@ Tighter output; suppress warnings. \fB\-C\fR, \fB\-\-nocolor\fR Don't output color. .TP +\fB\-\-color\fR +Force color in output. +.TP \fB\-h\fR, \fB\-\-help\fR Print this help and exit. .TP @@ -28,11 +28,12 @@ /* Required portage-utils stuff */ /********************************************************************/ -#define QKEYWORD_FLAGS "p:c:m:idtsanSTF:" COMMON_FLAGS +#define QKEYWORD_FLAGS "p:c:m:AidtsanSTF:" COMMON_FLAGS static struct option const qkeyword_long_opts[] = { {"matchpkg", a_argument, NULL, 'p'}, {"matchcat", a_argument, NULL, 'c'}, {"matchmaint", a_argument, NULL, 'm'}, + {"showarch", no_argument, NULL, 'A'}, {"imlate", no_argument, NULL, 'i'}, {"dropped", no_argument, NULL, 'd'}, {"needsstable", no_argument, NULL, 't'}, @@ -48,6 +49,7 @@ static const char * const qkeyword_opts_help[] = { "match pkgname", "match catname", "match maintainer email from metadata.xml (slow)", + "show selected arch from profile configuration", "list packages that can be marked stable for <arch>", "list packages that have dropped keywords for <arch>", "list packages that have ~arch versions, but no stable versions for <arch>", @@ -818,19 +820,22 @@ qkeyword_traverse(tree_pkg_cb func, void *priv) int qkeyword_main(int argc, char **argv) { - int i; - char action = '\0'; + int i; + char action = '\0'; + char *pkg = NULL; + char *cat = NULL; + char *maint = NULL; + bool showarch = false; qkeyword_data data; - char *pkg = NULL; - char *cat = NULL; - char *maint = NULL; data.fmt = NULL; while ((i = GETOPT_LONG(QKEYWORD, qkeyword, "")) != -1) { switch (i) { - case 'p': pkg = optarg; break; - case 'c': cat = optarg; break; - case 'm': maint = optarg; break; + case 'p': pkg = optarg; break; + case 'c': cat = optarg; break; + case 'm': maint = optarg; break; + case 'A': showarch = true; break; + case 'F': data.fmt = optarg; break; case 'i': case 'd': case 't': @@ -844,9 +849,6 @@ int qkeyword_main(int argc, char **argv) qkeyword_usage(EXIT_FAILURE); action = i; break; - case 'F': - data.fmt = optarg; - break; COMMON_GETOPTS_CASES(qkeyword) } @@ -860,6 +862,11 @@ int qkeyword_main(int argc, char **argv) optind + 1 < argc) qkeyword_usage(EXIT_FAILURE); + if (showarch) { + printf("%s\n", data.arch); + return EXIT_SUCCESS; + } + if (cat != NULL) { data.qatom = atom_explode_cat(pkg == NULL ? "" : pkg, cat); if (data.qatom == NULL) { |