# #
#############################################################################*/
-#include <errno.h>
+#include <argp.h>
#include <pakfire/pakfire.h>
#include <pakfire/repolist.h>
+#include "command.h"
#include "dump.h"
+#include "pakfire.h"
#include "repolist.h"
-int cli_repolist(struct pakfire* pakfire, int argc, char* argv[]) {
+static const char* doc = "List all available repositories";
+
+int cli_repolist(void* data, int argc, char* argv[]) {
+ struct pakfire* pakfire = NULL;
struct pakfire_repolist* list = NULL;
int r;
+ struct cli_config* cli_config = data;
+
+ // Parse the command line
+ r = cli_parse(NULL, NULL, NULL, doc, NULL, argc, argv, NULL);
+ if (r)
+ goto ERROR;
+
+ // Setup Pakfire
+ r = cli_setup_pakfire(&pakfire, cli_config);
+ if (r)
+ goto ERROR;
+
// Fetch all repositories
list = pakfire_get_repos(pakfire);
if (!list) {
ERROR:
if (list)
pakfire_repolist_unref(list);
+ if (pakfire)
+ pakfire_unref(pakfire);
return r;
}
#ifndef PAKFIRE_CLI_REPOLIST_H
#define PAKFIRE_CLI_REPOLIST_H
-#include <pakfire/pakfire.h>
-
-int cli_repolist(struct pakfire* pakfire, int argc, char* argv[]);
+int cli_repolist(void* data, int argc, char* argv[]);
#endif /* PAKFIRE_CLI_REPOLIST_H */
{ "info", cli_info, 1, -1, 0 },
{ "provides", cli_provides, 1, -1, 0 },
{ "repo", cli_repo, -1, -1, 0 },
+ { "repolist", cli_repolist, 0, 0, 0 },
{ "requires", cli_requires, 1, -1, 0 },
{ "search", cli_search, 1, -1, 0 },
+
#if 0
- { "repolist", 0, cli_repolist },
{ "shell", 0, cli_shell },
#endif
{ NULL },