summaryrefslogtreecommitdiff
path: root/src/ver.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-05-07 08:54:41 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2012-05-07 08:58:16 +0200
commit08595072ae2156a399253d34b41748da99e84bfc (patch)
tree909d73c79a5c1d107223a4fce485d1da49f6066f /src/ver.c
parent9154b8b5e44859ce0a1fd0ba292b26bf8dc8d046 (diff)
downloadapk-tools-08595072ae2156a399253d34b41748da99e84bfc.tar.gz
apk-tools-08595072ae2156a399253d34b41748da99e84bfc.tar.bz2
apk-tools-08595072ae2156a399253d34b41748da99e84bfc.tar.xz
apk-tools-08595072ae2156a399253d34b41748da99e84bfc.zip
ver: make --quiet output suitable for scripting/piping
Do not print version numbers or compare result char when in quiet mode. This makes the output suitable for be used in scripts or pipes. For example: # Upgrade all packages that matches a given regexp apk version --limit '<' --quiet | grep $regexp | apk fix --reinstall # Delete all packages that are removed from repository apk version --limit '?' --quiet | xargs apk del
Diffstat (limited to 'src/ver.c')
-rw-r--r--src/ver.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ver.c b/src/ver.c
index 90b6cd6..05ffce9 100644
--- a/src/ver.c
+++ b/src/ver.c
@@ -130,6 +130,10 @@ static void ver_print_package_status(struct ver_ctx *ictx, struct apk_database *
opstr = apk_version_op_string(r);
if ((ictx->limchars != NULL) && (strchr(ictx->limchars, *opstr) == NULL))
return;
+ if (apk_verbosity <= 0) {
+ printf("%s\n", pkg->name->name);
+ return;
+ }
snprintf(pkgname, sizeof(pkgname), PKG_VER_FMT,
PKG_VER_PRINTF(pkg));
printf("%-40s%s " BLOB_FMT, pkgname, opstr, BLOB_PRINTF(*latest));