예제 #1
0
def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument('yaml_file')

    args = parser.parse_args()

    try:
        insns = load_file(args.yaml_file)
    except RuntimeError as err:
        sys.stderr.write('{}\n'.format(err))
        return 1

    print(render_insns(insns, 2))
    return 0
예제 #2
0
def main() -> int:
    parser = argparse.ArgumentParser()
    parser.add_argument('yaml_file')
    parser.add_argument('out_dir')

    args = parser.parse_args()

    try:
        insns = load_file(args.yaml_file)
    except RuntimeError as err:
        print(err, file=sys.stderr)
        return 1

    try:
        os.makedirs(args.out_dir, exist_ok=True)
    except OSError as err:
        print('Failed to create output directory {!r}: {}.'.format(
            args.out_dir, err))

    render_insns(insns, 3, args.out_dir)
    return 0