@@ -43,7 +43,7 @@ def _parse_validate():
4343 type = PathExists ,
4444 action = "store" ,
4545 help = (
46- "the root of a BIDS dataset. It should contain "
46+ "The root of a BIDS dataset. It should contain "
4747 "sub-X directories and dataset_description.json"
4848 ),
4949 )
@@ -107,6 +107,41 @@ def _enter_validate(argv=None):
107107 workflows .validate (** args )
108108
109109
110+ def _parse_bids_version ():
111+ parser = argparse .ArgumentParser (
112+ description = "cubids bids-version: Get BIDS Validator and Schema version" ,
113+ formatter_class = argparse .ArgumentDefaultsHelpFormatter ,
114+ )
115+ PathExists = partial (_path_exists , parser = parser )
116+
117+ parser .add_argument (
118+ "bids_dir" ,
119+ type = PathExists ,
120+ action = "store" ,
121+ help = (
122+ "The root of a BIDS dataset. It should contain "
123+ "sub-X directories and dataset_description.json"
124+ ),
125+ )
126+ parser .add_argument (
127+ "--write" ,
128+ action = "store_true" ,
129+ default = False ,
130+ help = (
131+ "Save the validator and schema version to 'dataset_description.json' "
132+ "when using `cubids bids-version /bids/path --write`. "
133+ "By default, `cubids bids-version /bids/path` prints to the terminal."
134+ ),
135+ )
136+ return parser
137+
138+
139+ def _enter_bids_version (argv = None ):
140+ options = _parse_bids_version ().parse_args (argv )
141+ args = vars (options ).copy ()
142+ workflows .bids_version (** args )
143+
144+
110145def _parse_bids_sidecar_merge ():
111146 parser = argparse .ArgumentParser (
112147 description = ("bids-sidecar-merge: merge critical keys from one sidecar to another" ),
@@ -153,7 +188,7 @@ def _parse_group():
153188 type = PathExists ,
154189 action = "store" ,
155190 help = (
156- "the root of a BIDS dataset. It should contain "
191+ "The root of a BIDS dataset. It should contain "
157192 "sub-X directories and dataset_description.json"
158193 ),
159194 )
@@ -220,7 +255,7 @@ def _parse_apply():
220255 type = PathExists ,
221256 action = "store" ,
222257 help = (
223- "the root of a BIDS dataset. It should contain "
258+ "The root of a BIDS dataset. It should contain "
224259 "sub-X directories and dataset_description.json"
225260 ),
226261 )
@@ -316,7 +351,7 @@ def _parse_datalad_save():
316351 type = PathExists ,
317352 action = "store" ,
318353 help = (
319- "the root of a BIDS dataset. It should contain "
354+ "The root of a BIDS dataset. It should contain "
320355 "sub-X directories and dataset_description.json"
321356 ),
322357 )
@@ -358,7 +393,7 @@ def _parse_undo():
358393 type = PathExists ,
359394 action = "store" ,
360395 help = (
361- "the root of a BIDS dataset. It should contain "
396+ "The root of a BIDS dataset. It should contain "
362397 "sub-X directories and dataset_description.json"
363398 ),
364399 )
@@ -582,7 +617,7 @@ def _parse_remove_metadata_fields():
582617 type = PathExists ,
583618 action = "store" ,
584619 help = (
585- "the root of a BIDS dataset. It should contain "
620+ "The root of a BIDS dataset. It should contain "
586621 "sub-X directories and dataset_description.json"
587622 ),
588623 )
@@ -628,7 +663,7 @@ def _parse_print_metadata_fields():
628663 type = PathExists ,
629664 action = "store" ,
630665 help = (
631- "the root of a BIDS dataset. It should contain "
666+ "The root of a BIDS dataset. It should contain "
632667 "sub-X directories and dataset_description.json"
633668 ),
634669 )
@@ -655,6 +690,7 @@ def _enter_print_metadata_fields(argv=None):
655690
656691COMMANDS = [
657692 ("validate" , _parse_validate , workflows .validate ),
693+ ("bids-version" , _parse_bids_version , workflows .bids_version ),
658694 ("sidecar-merge" , _parse_bids_sidecar_merge , workflows .bids_sidecar_merge ),
659695 ("group" , _parse_group , workflows .group ),
660696 ("apply" , _parse_apply , workflows .apply ),
0 commit comments