diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-06-19 17:19:49 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-06-19 17:29:45 +0200 |
commit | 378ae7b02c62a0bad938752fc8b1a05165ccaf60 (patch) | |
tree | 545e5dee1d65186a247fe55a8be09a7540dea645 /src | |
parent | 61213c401886884b73406c0e536b2f5ee97425e1 (diff) | |
download | apk-tools-378ae7b02c62a0bad938752fc8b1a05165ccaf60.tar.gz apk-tools-378ae7b02c62a0bad938752fc8b1a05165ccaf60.tar.bz2 apk-tools-378ae7b02c62a0bad938752fc8b1a05165ccaf60.tar.xz apk-tools-378ae7b02c62a0bad938752fc8b1a05165ccaf60.zip |
info: add -w,--webpage and -s,--size options
Diffstat (limited to 'src')
-rw-r--r-- | src/info.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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 = { |