summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinspect.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/inspect.py b/inspect.py
index a6a3e9e..e89ffbd 100755
--- a/inspect.py
+++ b/inspect.py
@@ -4,6 +4,7 @@ import argparse
import logging
import os
import sys
+import json
from tools import libvmdk, libvslvm, lklfuse, nbdfuse, subfiles, unmount, rmdir
from tools.inspect_apps import (
@@ -27,6 +28,8 @@ parser.add_argument("-b", "--backend", type=str, default="nbdfuse",
"local filesystem (default: nbdfuse)")
parser.add_argument("-v", "--verbose", action="store_true",
help="print debug messages")
+parser.add_argument("--json", action="store_true",
+ help="format output as json")
args = parser.parse_args()
@@ -114,8 +117,14 @@ if lvm_mp:
unmount(image_mp)
rmdir(image_mp)
-print({
+output = {
"name": os_info.get("name", ""),
"version": os_info.get("version", ""),
"apps": apps
-})
+}
+
+if args.json:
+ print(json.dumps(output, indent = 2))
+else:
+ print(output)
+