From 74cb9b21096f5303e4a2c57ff05f77a1ff91c81a Mon Sep 17 00:00:00 2001 From: Susan Lee <109441419+suleesan@users.noreply.github.com> Date: Thu, 26 Oct 2023 16:47:45 -0700 Subject: [PATCH] hello --- tools/schemacode/bidsschematools/__main__.py | 31 ++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tools/schemacode/bidsschematools/__main__.py b/tools/schemacode/bidsschematools/__main__.py index c8d554cf0a..310f426416 100644 --- a/tools/schemacode/bidsschematools/__main__.py +++ b/tools/schemacode/bidsschematools/__main__.py @@ -4,7 +4,7 @@ import click from .schema import export_schema, load_schema - +from .validator import validate_bids @click.group() @click.option("-v", "--verbose", count=True) @@ -21,7 +21,7 @@ def export(ctx, schema, output): """Export BIDS schema to JSON document""" logger = logging.getLogger("bidsschematools") schema = load_schema(schema) - text = export_schema(schema) + text = export_schema(schema) if output == "-": logger.debug("Writing to stdout") print(text) @@ -32,5 +32,32 @@ def export(ctx, schema, output): fobj.write(text) +@cli.command() +@click.argument("in_paths", nargs=-1, required=True) +@click.option("--schema") +@click.option("--dummy_paths", is_flag=True) +@click.option("--bids_reference_root") +@click.option("--schema_path") +@click.option("--bids_version") +@click.option("--report_path", is_flag=True) +@click.option("--suppress_errors", is_flag=True) +@click.option("accept_non_bids_dir", is_flag=True) +@click.pass_context +def validate(ctx, schema, in_paths, dummy_paths, bids_reference_root, schema_path, bids_version, report_path, suppress_errors, accept_non_bids_dir): + """Validate BIDS Schema""" + logger = logging.getLogger("bidsschematools") + if schema: + schema_path = schema + validation_result = validate_bids(in_paths, dummy_paths, bids_reference_root, schema_path, bids_version, report_path, suppress_errors, accept_non_bids_dir) + logger.debug("Printing out path_tracking in validation_result dictionary") + if validation_result["path_tracking"]: + print(validation_result["path_tracking"]) + + + # print validation_result["path_tracking"] if not empty + # return 0 = success, non-zero = fail use Click exception handling + + + if __name__ == "__main__": cli()