summaryrefslogtreecommitdiff
path: root/src/ostree/ot-main.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2017-02-17 10:22:43 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-02-22 18:57:18 +0000
commit09b392675aa7ede9eb108cce478cc491080ac1f0 (patch)
tree9237f757998eecfe9cf006c6d0a051897c019e60 /src/ostree/ot-main.c
parent3ec509c89b07efbfc4b4d007327609b6dee77dd3 (diff)
downloadostree-09b392675aa7ede9eb108cce478cc491080ac1f0.tar.gz
main: Make ostree --version output YAML (and add gitrev)
I learned today that `docker version` does this and I really like the idea. While we have the patient open, also add the gitrev with code taken from https://github.com/projectatomic/rpm-ostree/pull/584 Closes: #691 Approved by: giuseppe
Diffstat (limited to 'src/ostree/ot-main.c')
-rw-r--r--src/ostree/ot-main.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c
index fb782275..c6a2b6dd 100644
--- a/src/ostree/ot-main.c
+++ b/src/ostree/ot-main.c
@@ -241,7 +241,16 @@ ostree_option_context_parse (GOptionContext *context,
if (opt_version)
{
- g_print ("%s\n %s\n", PACKAGE_STRING, OSTREE_FEATURES);
+ /* This should now be YAML, like `docker version`, so it's both nice to read
+ * possible to parse */
+ g_auto(GStrv) features = g_strsplit (OSTREE_FEATURES, " ", -1);
+ g_print ("%s:\n", PACKAGE_NAME);
+ g_print (" Version: %s\n", PACKAGE_VERSION);
+ if (strlen (OSTREE_GITREV) > 0)
+ g_print (" Git: %s\n", OSTREE_GITREV);
+ g_print (" Features:\n");
+ for (char **iter = features; iter && *iter; iter++)
+ g_print (" - %s\n", *iter);
exit (EXIT_SUCCESS);
}