#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Ufo2otf is a command line utility that takes UFO font sources and generate
OTF’s and webfonts.

usage: ufo2otf [-h] [--webfonts] [--afdko] infiles [infiles ...]

positional arguments:
  infiles     The source UFO files

optional arguments:
  -h, --help  show this help message and exit
  --webfonts  Generate webfonts in a ./webfonts subfolder
  --afdko     Generate the OTF with Adobe Font Development Kit for Opentype
"""

from ufo2otf import argparse, Compiler

def console():
    from sys import exit

    parser = argparse.ArgumentParser()
    parser.add_argument("infiles", help="The source UFO files", nargs='+')
    
    parser.add_argument("--webfonts", help="Generate webfonts in a ./webfonts subfolder",
                    action="store_true")
    parser.add_argument("--afdko", help="Generate the OTF with Adobe Font Development Kit for Opentype",
                    action="store_true")
    args = parser.parse_args()
    
    if args.webfonts and args.afdko:
        exit("Can not generate webfonts through the AFDKO, exiting.")

    c = Compiler(args.infiles, args.webfonts, args.afdko)
    c.compile()

if __name__ == "__main__":
    console()
