#!/usr/bin/env python3

import consist
import parse_csv
import parse_pygfx
import sys

db = consist.ConsistDb()
parse_csv.parse(db)
parse_pygfx.parse(db)

def main():
    with open(sys.argv[1], 'w', encoding='utf-8') as f:
        f.write(db.output_lang())

    with open(sys.argv[2], 'w', encoding='utf-8') as f:
        f.write(db.output_make_rules())

    with open(sys.argv[3], 'w', encoding='utf-8') as f:
        f.write(db.output_sort_order())
        f.write(db.output_nml())

main()
