From 378ae7b02c62a0bad938752fc8b1a05165ccaf60 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 19 Jun 2009 17:19:49 +0200 Subject: info: add -w,--webpage and -s,--size options --- src/info.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/info.c') diff --git a/src/info.c b/src/info.c index 3b24953..a7605eb 100644 --- a/src/info.c +++ b/src/info.c @@ -209,6 +209,26 @@ static void info_print_required_by(struct apk_package *pkg) puts(""); } +static void info_print_url(struct apk_package *pkg) +{ + if (apk_verbosity > 1) + printf("%s: %s\n", pkg->name->name, pkg->url); + else + printf("%s-%s webpage:\n%s\n\n", pkg->name->name, pkg->version, + pkg->url); + puts(""); +} + +static void info_print_size(struct apk_package *pkg) +{ + if (apk_verbosity > 1) + printf("%s: %i\n", pkg->name->name, pkg->installed_size); + else + printf("%s-%s installed size:\n%i\n\n", pkg->name->name, pkg->version, + pkg->installed_size); + puts(""); +} + static int info_parse(void *ctx, int optch, int optindex, const char *optarg) { struct info_ctx *ictx = (struct info_ctx *) ctx; @@ -220,6 +240,10 @@ static int info_parse(void *ctx, int optch, int optindex, const char *optarg) case 'W': ictx->action = info_who_owns; break; + case 'w': + ictx->action = info_package; + ictx->subaction = info_print_url; + break; case 'L': ictx->action = info_package; ictx->subaction = info_print_contents; @@ -232,6 +256,10 @@ static int info_parse(void *ctx, int optch, int optindex, const char *optarg) ictx->action = info_package; ictx->subaction = info_print_required_by; break; + case 's': + ictx->action = info_package; + ictx->subaction = info_print_size; + break; default: return -1; } @@ -262,6 +290,8 @@ static struct option info_options[] = { { "who-owns", no_argument, NULL, 'W' }, { "depends", no_argument, NULL, 'R' }, { "rdepends", no_argument, NULL, 'r' }, + { "webpage", no_argument, NULL, 'w' }, + { "size", no_argument, NULL, 's' }, }; static struct apk_applet apk_info = { -- cgit v1.2.3-60-g2f50