add-remote: Allow specifying local pathname instead of uri

This commit is contained in:
Alexander Larsson committed 2015-09-23 14:55:12 +02:00
1 parent 75b4f557b4
commit ee0cf9a247
2 files changed
+14 -6

No files matched your search

+12 -4
View File
@@ -145,11 +145,13 @@ xdg_app_builtin_add_remote (int argc, char **argv,
g_autoptr(XdgAppDir) dir = NULL;
g_autoptr(GVariantBuilder) optbuilder = NULL;
g_autoptr(GHashTable) refs = NULL;
g_autoptr(GFile) file = NULL;
g_autofree char *title = NULL;
g_autofree char *remote_url = NULL;
const char *remote_name;
const char *remote_url;
const char *url_or_path;
context = g_option_context_new ("NAME URL - Add a remote repository");
context = g_option_context_new ("NAME LOCATION - Add a remote repository");
g_option_context_add_main_entries (context, common_options, NULL);
@@ -158,12 +160,18 @@ xdg_app_builtin_add_remote (int argc, char **argv,
if (argc < 3)
{
usage_error (context, "NAME and URL must be specified", error);
usage_error (context, "NAME and LOCATION must be specified", error);
return FALSE;
}
remote_name = argv[1];
remote_url = argv[2];
url_or_path = argv[2];
file = g_file_new_for_commandline_arg (url_or_path);
if (g_file_is_native (file))
remote_url = g_file_get_uri (file);
else
remote_url = g_strdup (url_or_path);
optbuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
+2 -2
View File
@@ -33,7 +33,7 @@
<command>xdg-app add-remote</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain">NAME</arg>
<arg choice="plain">URL</arg>
<arg choice="plain">LOCATION</arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -43,7 +43,7 @@
<para>
Adds a remote repository to the xdg-app repository configuration.
<arg choice="plain">NAME</arg> is the name for the new remote, and
<arg choice="plain">URL</arg> is the location for the repository.
<arg choice="plain">LOCATION</arg> is the url or pathname for the repository.
</para>
<para>
Unless overridden with the --user option, this command changes