forked from Mirrors/flatpak-builder
parent
64fc43101d
commit
20a0917306
|
@ -16,6 +16,7 @@ xdg_app_SOURCES = \
|
||||||
xdg-app-main.c \
|
xdg-app-main.c \
|
||||||
xdg-app-builtins.h \
|
xdg-app-builtins.h \
|
||||||
xdg-app-builtins-add-repo.c \
|
xdg-app-builtins-add-repo.c \
|
||||||
|
xdg-app-builtins-delete-repo.c \
|
||||||
xdg-app-builtins-install.c \
|
xdg-app-builtins-install.c \
|
||||||
xdg-app-builtins-update.c \
|
xdg-app-builtins-update.c \
|
||||||
xdg-app-builtins-run.c \
|
xdg-app-builtins-run.c \
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "libgsystem.h"
|
||||||
|
|
||||||
|
#include "xdg-app-builtins.h"
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage_error (GOptionContext *context, const char *message, GError **error)
|
||||||
|
{
|
||||||
|
gs_free gchar *help = g_option_context_get_help (context, TRUE, NULL);
|
||||||
|
g_printerr ("%s", help);
|
||||||
|
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
xdg_app_builtin_delete_repo (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||||
|
{
|
||||||
|
GOptionContext *context;
|
||||||
|
gboolean ret = FALSE;
|
||||||
|
gs_unref_object XdgAppDir *dir = NULL;
|
||||||
|
const char *remote_name;
|
||||||
|
|
||||||
|
context = g_option_context_new ("NAME - Delete a remote repository");
|
||||||
|
|
||||||
|
if (!xdg_app_option_context_parse (context, NULL, &argc, &argv, 0, &dir, cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
usage_error (context, "NAME must be specified", error);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
remote_name = argv[1];
|
||||||
|
|
||||||
|
if (!ostree_repo_remote_change (xdg_app_dir_get_repo (dir), NULL,
|
||||||
|
OSTREE_REPO_REMOTE_CHANGE_DELETE,
|
||||||
|
remote_name, NULL,
|
||||||
|
NULL,
|
||||||
|
cancellable, error))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (context)
|
||||||
|
g_option_context_free (context);
|
||||||
|
return ret;
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ gboolean xdg_app_option_context_parse (GOptionContext *context,
|
||||||
#define BUILTINPROTO(name) gboolean xdg_app_builtin_ ## name (int argc, char **argv, GCancellable *cancellable, GError **error)
|
#define BUILTINPROTO(name) gboolean xdg_app_builtin_ ## name (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||||
|
|
||||||
BUILTINPROTO(add_repo);
|
BUILTINPROTO(add_repo);
|
||||||
|
BUILTINPROTO(delete_repo);
|
||||||
BUILTINPROTO(install_runtime);
|
BUILTINPROTO(install_runtime);
|
||||||
BUILTINPROTO(update_runtime);
|
BUILTINPROTO(update_runtime);
|
||||||
BUILTINPROTO(install_app);
|
BUILTINPROTO(install_app);
|
||||||
|
|
|
@ -20,6 +20,7 @@ typedef struct {
|
||||||
|
|
||||||
static XdgAppCommand commands[] = {
|
static XdgAppCommand commands[] = {
|
||||||
{ "add-repo", xdg_app_builtin_add_repo },
|
{ "add-repo", xdg_app_builtin_add_repo },
|
||||||
|
{ "delete-repo", xdg_app_builtin_delete_repo },
|
||||||
{ "install-runtime", xdg_app_builtin_install_runtime },
|
{ "install-runtime", xdg_app_builtin_install_runtime },
|
||||||
{ "update-runtime", xdg_app_builtin_update_runtime },
|
{ "update-runtime", xdg_app_builtin_update_runtime },
|
||||||
{ "install-app", xdg_app_builtin_install_app },
|
{ "install-app", xdg_app_builtin_install_app },
|
||||||
|
|
Loading…
Reference in New Issue