mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-16 12:50:01 -04:00
Add flatpak --supported-arches
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
static gboolean opt_verbose;
|
||||
static gboolean opt_version;
|
||||
static gboolean opt_default_arch;
|
||||
static gboolean opt_supported_arches;
|
||||
static gboolean opt_user;
|
||||
|
||||
typedef struct
|
||||
@@ -99,6 +100,7 @@ GOptionEntry global_entries[] = {
|
||||
static GOptionEntry empty_entries[] = {
|
||||
{ "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version information and exit", NULL },
|
||||
{ "default-arch", 0, 0, G_OPTION_ARG_NONE, &opt_default_arch, "Print default arch and exit", NULL },
|
||||
{ "supported-arches", 0, 0, G_OPTION_ARG_NONE, &opt_supported_arches, "Print supported arches and exit", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
@@ -214,6 +216,15 @@ flatpak_option_context_parse (GOptionContext *context,
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (opt_supported_arches)
|
||||
{
|
||||
const char **arches = flatpak_get_arches ();
|
||||
int i;
|
||||
for (i = 0; arches[i] != NULL; i++)
|
||||
g_print ("%s\n", arches[i]);
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
|
||||
{
|
||||
dir = flatpak_dir_get (opt_user);
|
||||
|
||||
@@ -86,14 +86,6 @@
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--default-arch</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Print the default arch and exit.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-r</option></term>
|
||||
<term><option>--runtime</option></term>
|
||||
|
||||
@@ -97,6 +97,23 @@
|
||||
Print version information and exit.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--default-arch</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Print the default arch and exit.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>--supported-arches</option></term>
|
||||
|
||||
<listitem><para>
|
||||
Print the supported arches in priority order and exit.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
||||
@@ -36,6 +36,10 @@ assert_file_has_content help_out "^Usage:$"
|
||||
|
||||
echo "ok help"
|
||||
|
||||
${FLATPAK} --default-arch > /dev/null
|
||||
${FLATPAK} --default-arch > arch
|
||||
|
||||
${FLATPAK} --supported-arches > arches
|
||||
|
||||
assert_streq `head -1 arches` `cat arch`
|
||||
|
||||
echo "ok default arch"
|
||||
|
||||
Reference in New Issue
Block a user