"""GeoNetwork validate command line interface."""

from argparse import ArgumentParser

from ..geonetwork import validate


def cli_validate(argv=None):
    """CLI to validate geonetwork ressources."""
    parser = ArgumentParser(description="Geonetwork ressource validator")
    parser.add_argument("uuid", help="Ressource UUID.", nargs="+")

    args, _ = parser.parse_known_args(argv)

    for uuid in args.uuid:
        if validate(uuid, verbose=False):
            print("  🙌 Valid: A DOI can be issued for this resource")
        print()
