55from geophires_x_schema_generator import GeophiresXSchemaGenerator
66from geophires_x_schema_generator import HipRaXSchemaGenerator
77
8- if __name__ == '__main__' :
9- parser = argparse .ArgumentParser ()
10- parser .add_argument ('--build-in-src' , required = False , choices = [True , False ], default = True )
11- parser .add_argument ('--build-path' , required = False )
12- args = parser .parse_args ()
13- build_in_src = args .build_in_src
148
9+ def generate_schemas (build_in_src : bool , build_path : str | Path ) -> None :
1510 build_dir = Path (Path (__file__ ).parent )
16- if not args . build_in_src :
11+ if not build_in_src :
1712 build_dir = Path (Path (__file__ ).parent .parent .parent , 'build' )
1813
19- if args . build_path :
20- build_dir = Path (args . build_path )
14+ if build_path :
15+ build_dir = Path (build_path )
2116
2217 build_dir .mkdir (exist_ok = True )
2318
@@ -44,3 +39,13 @@ def build(json_file_name_prefix: str, generator: GeophiresXSchemaGenerator, rst_
4439
4540 build ('geophires-' , GeophiresXSchemaGenerator (), 'parameters.rst' )
4641 build ('hip-ra-x-' , HipRaXSchemaGenerator (), 'hip_ra_x_parameters.rst' )
42+
43+
44+ if __name__ == '__main__' :
45+ parser = argparse .ArgumentParser ()
46+ parser .add_argument ('--build-in-src' , required = False , choices = [True , False ], default = True )
47+ parser .add_argument ('--build-path' , required = False )
48+ args = parser .parse_args ()
49+ build_in_src_ = args .build_in_src
50+ build_path_ = args .build_path if args .build_path else None
51+ generate_schemas (build_in_src_ , build_path_ )
0 commit comments