summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcompletion/xdg-app8
-rw-r--r--doc/xdg-app-repo-update.xml9
-rw-r--r--xdg-app-builtins-repo-update.c21
3 files changed, 34 insertions, 4 deletions
diff --git a/completion/xdg-app b/completion/xdg-app
index 949063d..ee14c49 100755
--- a/completion/xdg-app
+++ b/completion/xdg-app
@@ -33,7 +33,8 @@ _xdg-app() {
[BUILD]='--runtime --network --x11'
[BUILD_FINISH]='--command --allow'
[BUILD_EXPORT]='--subject --body'
- [ARG]='--arch --command --branch --var --allow --forbid --subject --body --runtime'
+ [REPO_UPDATE]='--title'
+ [ARG]='--arch --command --branch --var --allow --forbid --subject --body --title --runtime'
)
if __contains_word "--user" ${COMP_WORDS[*]}; then
@@ -56,7 +57,7 @@ _xdg-app() {
--allow|--forbid)
comps='x11 wayland ipc pulseaudio system-dbus session-dbus network host-fs homedir'
;;
- --branch|--subject|--body)
+ --branch|--subject|--body|--title)
comps=''
;;
esac
@@ -152,6 +153,9 @@ _xdg-app() {
if [ "$verb" = "build-export" ]; then
comps="$comps ${OPTS[BUILD_EXPORT]}"
fi
+ if [ "$verb" = "repo-update" ]; then
+ comps="$comps ${OPTS[REPO_UPDATE]}"
+ fi
else
case "$verb" in
diff --git a/doc/xdg-app-repo-update.xml b/doc/xdg-app-repo-update.xml
index 77da7af..fe48d1b 100644
--- a/doc/xdg-app-repo-update.xml
+++ b/doc/xdg-app-repo-update.xml
@@ -69,6 +69,15 @@
</varlistentry>
<varlistentry>
+ <term><option>--title=TITLE</option></term>
+
+ <listitem><para>
+ A title for the repository, e.g. for display in a UI.
+ The title is stored in the repository summary.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
<term><option>-v</option></term>
<term><option>--verbose</option></term>
diff --git a/xdg-app-builtins-repo-update.c b/xdg-app-builtins-repo-update.c
index 913a8fb..6c90ea3 100644
--- a/xdg-app-builtins-repo-update.c
+++ b/xdg-app-builtins-repo-update.c
@@ -10,6 +10,13 @@
#include "xdg-app-builtins.h"
#include "xdg-app-utils.h"
+static char *opt_title;
+
+static GOptionEntry options[] = {
+ { "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, "A nice name to use for this repository", "TITLE" },
+ { NULL }
+};
+
gboolean
xdg_app_builtin_repo_update (int argc, char **argv, GCancellable *cancellable, GError **error)
@@ -19,10 +26,11 @@ xdg_app_builtin_repo_update (int argc, char **argv, GCancellable *cancellable, G
gs_unref_object GFile *repofile = NULL;
gs_unref_object OstreeRepo *repo = NULL;
const char *location;
+ GVariant *extra = NULL;
context = g_option_context_new ("LOCATION - Update repository metadata");
- if (!xdg_app_option_context_parse (context, NULL, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
+ if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
goto out;
if (argc < 2)
@@ -39,7 +47,16 @@ xdg_app_builtin_repo_update (int argc, char **argv, GCancellable *cancellable, G
if (!ostree_repo_open (repo, cancellable, error))
goto out;
- if (!ostree_repo_regenerate_summary (repo, NULL, cancellable, error))
+ if (opt_title)
+ {
+ GVariantBuilder builder;
+
+ g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
+ g_variant_builder_add (&builder, "{sv}", "xa.title", g_variant_new_string (opt_title));
+ extra = g_variant_builder_end (&builder);
+ }
+
+ if (!ostree_repo_regenerate_summary (repo, extra, cancellable, error))
goto out;
/* TODO: appstream data */