#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
# Alan Viars

import argparse
import json
from jdt.jsonlist2ndjson import jsonlist2ndjson

if __name__ == "__main__":
    
    # Parse args
    parser = argparse.ArgumentParser(
        description='Load in file with a JSON list that contains a JSON objects and convert it into a single NDJSON file.')

    parser.add_argument(
        dest='input_JSON',
        action='store',
        help='Input the JSON list to load here')

    parser.add_argument(
        dest='output_NDJSON_file',
        action='store',
        help="Enter the output NDJSON filename")

    args = parser.parse_args()

    result = jsonlist2ndjson(args.input_JSON, args.output_NDJSON_file)

    # output the JSON transaction summary
    print(json.dumps(result, indent=4))
