#!/usr/bin/python

from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, FileType

from . import doc_split, usage, version
from .make_font import make_font


def _arg_parser() -> object:
    parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
    parser.add_argument(
        'cgrom_handle', metavar='CG', type=FileType('rb'),
        help='character rom file')
    parser.add_argument(
        'monitor_handle', metavar='MONITOR', type=FileType('rb'),
        help='monitor rom file')
    parser.add_argument(
        'ttf_handle', metavar='TTF', type=str, help='output file')
    return parser


def main():
    parser = _arg_parser()

    try:
        args = parser.parse_args()
    except IOError as error:
        parser.error(error)

    make_font(args.cgrom_handle, args.monitor_handle, args.ttf_handle)


if __name__ == '__main__':
    main()
