#include <pakfire/pakfire.h>
#include "clean.h"
+#include "command.h"
+#include "pakfire.h"
-int cli_clean(struct pakfire* pakfire, int argc, char* argv[]) {
- return pakfire_clean(pakfire, 0);
+int cli_clean(void* data, int argc, char* argv[]) {
+ struct pakfire* pakfire = NULL;
+ int r;
+
+ struct cli_config* config = data;
+
+ // Parse the command line
+ r = cli_parse(NULL, NULL, NULL, NULL, argc, argv, NULL);
+ if (r)
+ goto ERROR;
+
+ // Setup Pakfire
+ r = cli_setup_pakfire(&pakfire, config);
+ if (r)
+ goto ERROR;
+
+ // Clean!
+ r = pakfire_clean(pakfire, 0);
+
+ERROR:
+ if (pakfire)
+ pakfire_unref(pakfire);
+
+ return r;
}
#ifndef PAKFIRE_CLI_CLEAN_H
#define PAKFIRE_CLI_CLEAN_H
-#include <pakfire/pakfire.h>
-
-int cli_clean(struct pakfire* pakfire, int argc, char* argv[]);
+int cli_clean(void* data, int argc, char* argv[]);
#endif /* PAKFIRE_CLI_CLEAN_H */
int arg_index = 0;
// Parse command line options
- r = argp_parse(&parser, argc, argv, ARGP_IN_ORDER, &arg_index, &ctx);
+ r = argp_parse(options ? &parser : NULL, argc, argv, ARGP_IN_ORDER, &arg_index, &ctx);
if (r)
return r;
static const struct command commands[] = {
{ "build", CLI_REQUIRE_ONE_OR_MORE_ARGUMENTS, cli_build },
-#if 0
{ "clean", 0, cli_clean },
+#if 0
{ "dist", 0, cli_dist },
{ "image", 0, cli_image },
{ "info", 0, cli_info },