Add a --title option to add-remote

This stores a string in the remote configuration which can
be used in UIs when talking about the remote.
tingping/wmclass
Matthias Clasen 2015-02-06 11:11:10 +01:00
parent 4903fe100d
commit 06608ba7d5
2 changed files with 14 additions and 0 deletions

View File

@ -99,6 +99,14 @@
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--title=TITLE</option></term>
<listitem><para>
A title for the remote, e.g. for display in a UI.
</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option></term>
<term><option>--verbose</option></term>

View File

@ -10,10 +10,12 @@
static gboolean opt_no_gpg_verify;
static gboolean opt_if_not_exists;
static char *opt_title;
static GOptionEntry options[] = {
{ "no-gpg-verify", 0, 0, G_OPTION_ARG_NONE, &opt_no_gpg_verify, "Disable GPG verification", NULL },
{ "if-not-exists", 0, 0, G_OPTION_ARG_NONE, &opt_if_not_exists, "Do nothing if the provided remote exists", NULL },
{ "title", 0, 0, G_OPTION_ARG_STRING, &opt_title, "A nice name to use for this remote", "TITLE" },
{ NULL }
};
@ -47,6 +49,10 @@ xdg_app_builtin_add_remote (int argc, char **argv, GCancellable *cancellable, GE
g_variant_builder_add (optbuilder, "{s@v}",
"gpg-verify",
g_variant_new_variant (g_variant_new_boolean (FALSE)));
if (opt_title)
g_variant_builder_add (optbuilder, "{s@v}",
"title",
g_variant_new_variant (g_variant_new_string (opt_title)));
if (!ostree_repo_remote_change (xdg_app_dir_get_repo (dir), NULL,
opt_if_not_exists ? OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS :