#!/usr/bin/env python

import json
import sys
import yaml

import click


@click.command()
@click.argument("f", type=click.Path(exists=True), required=False)
def main(f):
    if f is None:
        obj = yaml.load(sys.stdin, Loader=yaml.FullLoader)
        print(json.dumps(obj))
    else:
        obj = yaml.load(open(f, "rt"), Loader=yaml.FullLoader)
        print(json.dumps(obj))


if __name__ == "__main__":
    main()
