Make repo-contents operate on a single repo

This is more in line with the other commands.
tingping/wmclass
Matthias Clasen 2015-01-15 23:42:48 -05:00
parent d112b320b2
commit 4490029880
2 changed files with 17 additions and 6 deletions

View File

@ -32,6 +32,7 @@
<cmdsynopsis>
<command>xdg-app repo-contents</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain">REPOSITORY</arg>
</cmdsynopsis>
</refsynopsisdiv>
@ -39,8 +40,8 @@
<title>Description</title>
<para>
Shows runtimes and applications that are available in the configured
repositories.
Shows runtimes and applications that are available in the
repository <arg choice="plain">REPOSITORY</arg>.
</para>
<para>
xdg-app can operate in system-wide or per-user mode. The system-wide
@ -124,13 +125,11 @@
<title>Examples</title>
<para>
<command>$ xdg-app --user repo-contents --only-apps</command>
<command>$ xdg-app --user repo-contents --only-apps testrepo</command>
</para>
<programlisting>
org.gnome.Builder
org.freedesktop.glxgears
org.gnome.MyApp
org.gnome.GEdit
</programlisting>
</refsect1>

View File

@ -32,12 +32,21 @@ xdg_app_builtin_repo_contents (int argc, char **argv, GCancellable *cancellable,
GHashTableIter iter;
gpointer key;
gs_unref_hashtable GHashTable *seen = NULL;
const char *repository;
context = g_option_context_new (" - Show available runtimes and applications");
context = g_option_context_new (" REPOSITORY - Show available runtimes and applications");
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
goto out;
if (argc < 2)
{
usage_error (context, "REPOSITORY must be specified", error);
goto out;
}
repository = argv[1];
repo = xdg_app_dir_get_repo (dir);
if (!ostree_repo_list_refs (repo, NULL, &refs, cancellable, error))
goto out;
@ -56,6 +65,9 @@ xdg_app_builtin_repo_contents (int argc, char **argv, GCancellable *cancellable,
if (!ostree_parse_refspec (refspec, &remote, &ref, error))
goto out;
if (!g_str_equal (remote, repository))
continue;
if (g_str_has_prefix (ref, "runtime/") && !opt_only_apps)
{
name = g_strdup (ref + strlen ("runtime/"));