summaryrefslogtreecommitdiff
path: root/src/del.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-08-04 10:57:33 +0300
committerTimo Teras <timo.teras@iki.fi>2009-08-04 10:57:33 +0300
commit6f8526da3e7fb055dc3ee640b943906e517f63f1 (patch)
tree974b1ebaf99a9defc4bf5d3989d1d5c738295172 /src/del.c
parent59dcbfefeeeb42bc5a499f7bc9540111179e6cbe (diff)
downloadapk-tools-6f8526da3e7fb055dc3ee640b943906e517f63f1.tar.gz
apk-tools-6f8526da3e7fb055dc3ee640b943906e517f63f1.tar.bz2
apk-tools-6f8526da3e7fb055dc3ee640b943906e517f63f1.tar.xz
apk-tools-6f8526da3e7fb055dc3ee640b943906e517f63f1.zip
del: add '-r' to remove top-level dependencies recursively
and by default just update the world, and dump a lost of packages that are not removed. fixes #47.
Diffstat (limited to 'src/del.c')
-rw-r--r--src/del.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/del.c b/src/del.c
index b7f2ce5..7d4a443 100644
--- a/src/del.c
+++ b/src/del.c
@@ -14,6 +14,18 @@
#include "apk_state.h"
#include "apk_database.h"
+static int del_parse(void *ctx, int optch, int optindex, const char *optarg)
+{
+ switch (optch) {
+ case 'r':
+ apk_flags |= APK_RECURSIVE_DELETE;
+ break;
+ default:
+ return -1;
+ }
+ return 0;
+}
+
static int del_main(void *ctx, int argc, char **argv)
{
struct apk_database db;
@@ -58,10 +70,18 @@ out:
return r;
}
+static struct apk_option del_options[] = {
+ { 'r', "rdepends", "Recursively delete all top-level reverse "
+ "dependencies too." },
+};
+
static struct apk_applet apk_del = {
.name = "del",
.help = "Remove PACKAGEs from the main dependencies and uninstall them.",
.arguments = "PACKAGE...",
+ .num_options = ARRAY_SIZE(del_options),
+ .options = del_options,
+ .parse = del_parse,
.main = del_main,
};