diff options
author | Alexander Larsson <alexl@redhat.com> | 2017-06-19 10:58:09 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2017-06-19 10:58:09 +0200 |
commit | 504a3a25ea0dfdaa2fc8f3f929f7e0c7dc23da85 (patch) | |
tree | 1151c5bfaa9c28006f107f7effaf82d7210323cb /app/flatpak-builtins-info.c | |
parent | 66e60be49de004a5b51d321ad320853516a773d7 (diff) | |
download | flatpak-504a3a25ea0dfdaa2fc8f3f929f7e0c7dc23da85.tar.gz |
info: Make --show-metadata machine parseable
This is useful mainly to parse the keyfile, and is not very
nice for pretty output.
Diffstat (limited to 'app/flatpak-builtins-info.c')
-rw-r--r-- | app/flatpak-builtins-info.c | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/app/flatpak-builtins-info.c b/app/flatpak-builtins-info.c index 9ab826e8..22368adb 100644 --- a/app/flatpak-builtins-info.c +++ b/app/flatpak-builtins-info.c @@ -149,7 +149,7 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError * metakey = flatpak_deploy_get_metadata (deploy); - if (opt_show_ref || opt_show_origin || opt_show_commit || opt_show_size) + if (opt_show_ref || opt_show_origin || opt_show_commit || opt_show_size || opt_show_metadata) friendly = FALSE; if (friendly) @@ -213,6 +213,22 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError * if (!first) g_print ("\n"); + + if (opt_show_metadata) + { + g_autoptr(GFile) deploy_dir = NULL; + g_autoptr(GFile) file = NULL; + g_autofree char *data = NULL; + gsize data_size; + + deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable); + file = g_file_get_child (deploy_dir, "metadata"); + + if (!g_file_load_contents (file, cancellable, &data, &data_size, NULL, error)) + return FALSE; + + g_print ("%s", data); + } } if (opt_show_extensions) @@ -264,24 +280,6 @@ flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError * } } - if (opt_show_metadata) - { - g_autoptr(GFile) deploy_dir = NULL; - g_autoptr(GFile) file = NULL; - g_autofree char *data = NULL; - gsize data_size; - - g_print ("\n%s%s%s\n", on, _("Metadata:"), off); - - deploy_dir = flatpak_dir_get_if_deployed (dir, ref, NULL, cancellable); - file = g_file_get_child (deploy_dir, "metadata"); - - if (!g_file_load_contents (file, cancellable, &data, &data_size, NULL, error)) - return FALSE; - - g_print ("%s\n", data); - } - return TRUE; } |