--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2023 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#include <argp.h>
+
+#include <json.h>
+
+#include <pakfire/buildservice.h>
+
+#include "command.h"
+#include "dump.h"
+#include "pakfire.h"
+#include "repo_delete.h"
+
+static const char* args_doc = "DISTRO NAME";
+
+static const char* doc = "Delete a repository";
+
+struct config {
+ const char* distro;
+ const char* name;
+};
+
+static error_t parse(int key, char* arg, struct argp_state* state, void* data) {
+ struct config* config = data;
+
+ switch (key) {
+ case ARGP_KEY_ARG:
+ if (!config->distro)
+ config->distro = arg;
+
+ else if (!config->name)
+ config->name = arg;
+
+ else
+ argp_usage(state);
+ break;
+
+ default:
+ return ARGP_ERR_UNKNOWN;
+ }
+
+ return 0;
+}
+
+int cli_repo_delete(void* data, int argc, char* argv[]) {
+ struct pakfire_buildservice* service = NULL;
+ struct json_object* repo = NULL;
+ struct config config = {};
+ int r;
+
+ struct cli_config* cli_config = data;
+
+ // Parse the command line
+ r = cli_parse(NULL, NULL, args_doc, doc, parse, argc, argv, &config);
+ if (r)
+ goto ERROR;
+
+ // Connect to the build service
+ r = pakfire_buildservice_create(&service, cli_config->ctx);
+ if (r)
+ goto ERROR;
+
+ // Delete the repository
+ r = pakfire_buildservice_delete_repo(service, config.distro, config.name);
+ if (r)
+ goto ERROR;
+
+ERROR:
+ if (service)
+ pakfire_buildservice_unref(service);
+ if (repo)
+ json_object_put(repo);
+
+ return r;
+}
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2023 Pakfire development team #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#ifndef PAKFIRE_CLI_REPO_DELETE_H
+#define PAKFIRE_CLI_REPO_DELETE_H
+
+int cli_repo_delete(void* data, int argc, char* argv[]);
+
+#endif /* PAKFIRE_CLI_REPO_DELETE_H */