mirror of
https://github.com/flatpak/flatpak.git
synced 2026-01-17 04:08:23 -05:00
remote-ls: Don't show Locale/Debug and secondary arches by default.
Locale and Debug extensions, and refs for a secondary arch, when the primary arch alternative exists, are not shown unless you specify --all or -a. This makes the default output more useful.
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
static gboolean opt_show_details;
|
||||
static gboolean opt_runtime;
|
||||
static gboolean opt_app;
|
||||
static gboolean opt_all;
|
||||
static gboolean opt_only_updates;
|
||||
static char *opt_arch;
|
||||
|
||||
@@ -45,6 +46,7 @@ static GOptionEntry options[] = {
|
||||
{ "app", 0, 0, G_OPTION_ARG_NONE, &opt_app, N_("Show only apps"), NULL },
|
||||
{ "updates", 0, 0, G_OPTION_ARG_NONE, &opt_only_updates, N_("Show only those where updates are available"), NULL },
|
||||
{ "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, N_("Limit to this arch (* for all)"), N_("ARCH") },
|
||||
{ "all", 'a', 0, G_OPTION_ARG_NONE, &opt_all, N_("List all refs (including locale/debug)"), NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -157,6 +159,34 @@ flatpak_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
||||
else
|
||||
name = ref;
|
||||
|
||||
if (!opt_all &&
|
||||
strcmp (parts[0], "runtime") == 0 &&
|
||||
(g_str_has_suffix (parts[1], ".Locale") ||
|
||||
g_str_has_suffix (parts[1], ".Debug")))
|
||||
{
|
||||
g_autofree char *prefix_partial_ref1 = NULL;
|
||||
g_autofree char *prefix_partial_ref2 = NULL;
|
||||
char *last_dot = strrchr (parts[1], '.');
|
||||
|
||||
*last_dot = 0;
|
||||
prefix_partial_ref1 = g_strconcat ("app/", parts[1], "/", parts[2], "/", parts[3], NULL);
|
||||
prefix_partial_ref2 = g_strconcat ("runtime/", parts[1], "/", parts[2], "/", parts[3], NULL);
|
||||
*last_dot = '.';
|
||||
|
||||
if (g_hash_table_lookup (refs, prefix_partial_ref1) ||
|
||||
g_hash_table_lookup (refs, prefix_partial_ref2))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!opt_all && opt_arch == NULL &&
|
||||
/* Hide non-primary arches if the primary arch exists */
|
||||
strcmp (arches[0], parts[2]) != 0)
|
||||
{
|
||||
g_autofree char *alt_arch_ref = g_strconcat (parts[0], "/", parts[1], "/", arches[0], "/", parts[3], NULL);
|
||||
if (g_hash_table_lookup (refs, alt_arch_ref))
|
||||
continue;
|
||||
}
|
||||
|
||||
if (g_hash_table_lookup (names, name) == NULL)
|
||||
g_hash_table_insert (names, g_strdup (name), g_strdup (checksum));
|
||||
}
|
||||
|
||||
@@ -118,6 +118,16 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--all</option></term>
|
||||
<term><option>-a</option></term>
|
||||
|
||||
<listitem><para> Show everything. By default locale and
|
||||
debug extensions as well as secondary arches when the primary
|
||||
arch in available are hidden.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--updates</option></term>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user