Skip to content

Commit

Permalink
hello
Browse files Browse the repository at this point in the history
  • Loading branch information
suleesan committed Oct 26, 2023
1 parent 2d0c111 commit 74cb9b2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions tools/schemacode/bidsschematools/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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()

0 comments on commit 74cb9b2

Please sign in to comment.