diff --git a/app/flatpak-main.c b/app/flatpak-main.c index f74d807a..6a8ec7a9 100644 --- a/app/flatpak-main.c +++ b/app/flatpak-main.c @@ -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); diff --git a/doc/flatpak-build.xml b/doc/flatpak-build.xml index 1695f74c..a802753c 100644 --- a/doc/flatpak-build.xml +++ b/doc/flatpak-build.xml @@ -86,14 +86,6 @@ - - - - - Print the default arch and exit. - - - diff --git a/doc/flatpak.xml b/doc/flatpak.xml index 236c2577..469cb0a4 100644 --- a/doc/flatpak.xml +++ b/doc/flatpak.xml @@ -97,6 +97,23 @@ Print version information and exit. + + + + + + Print the default arch and exit. + + + + + + + + Print the supported arches in priority order and exit. + + + diff --git a/tests/test-basic.sh b/tests/test-basic.sh index 5540de4d..f83143eb 100755 --- a/tests/test-basic.sh +++ b/tests/test-basic.sh @@ -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"