Commit cf9c8c6c authored by Vincent Stehlé's avatar Vincent Stehlé
Browse files add json output

Add a --json command line option to dump our data in json format.

Signed-off-by: Vincent Stehlé's avatarVincent Stehlé <>
parent c2ba6f1e
......@@ -6,6 +6,7 @@ import sys
import argparse
import csv
import logging
import json
#based loosley on
......@@ -182,6 +183,14 @@ def gen_csv(cross_check, filename):
# Generate json
def gen_json(cross_check, filename):
logging.debug(f'Generate {filename}')
with open(filename, 'w') as jsonfile:
json.dump(cross_check, jsonfile, sort_keys=True, indent=2)
def main():
parser = argparse.ArgumentParser(
description='Process SCT results.'
......@@ -189,6 +198,7 @@ def main():
' and generates a nice report in mardown format.',
parser.add_argument('--csv', help='Output .csv filename')
parser.add_argument('--json', help='Output .json filename')
'--md', help='Output .md filename', default='')
......@@ -272,6 +282,10 @@ def main():
if args.csv is not None:
gen_csv(cross_check, args.csv)
# Generate json if requested
if args.json is not None:
gen_json(cross_check, args.json)
#command line argument 3&4, key are to support a key & value search.
#these will be displayed in CLI
if args.find_key is not None and args.find_value is not None:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment