@@ -598,6 +598,9 @@ def ensure_csvreader(self, file_name: str, delimiter=None) -> str:
598598 type = click .File (mode = "w" ),
599599 default = sys .stdout ,
600600 help = "output file" )
601+ @click .option ('-s' , '--sort-keys' ,
602+ default = False ,
603+ help = "Sort keys in schema output? For example permissible values in an enumeration? Defaults to False." )
601604@click .option ("-n" , "--name" ,
602605 help = "name of the schema" )
603606@click .option ("-C" , "--table-config-path" ,
@@ -619,7 +622,7 @@ def ensure_csvreader(self, file_name: str, delimiter=None) -> str:
619622 help = "Google sheets ID. If this is specified then the arguments MUST be sheet names" )
620623@click .option ("-v" , "--verbose" , count = True )
621624@click .argument ('tsv_files' , nargs = - 1 )
622- def convert (tsv_files , gsheet_id , output : TextIO , name , repair , table_config_path : str , use_attributes : bool , unique_slots : bool , verbose : int ):
625+ def convert (tsv_files , gsheet_id , output : TextIO , name , repair , table_config_path : str , use_attributes : bool , unique_slots : bool , verbose : int , sort_keys : bool ):
623626 """
624627 Convert schemasheets to a LinkML schema
625628
@@ -649,7 +652,7 @@ def convert(tsv_files, gsheet_id, output: TextIO, name, repair, table_config_pat
649652 if repair :
650653 schema = sm .repair_schema (schema )
651654 schema_dict = schema_as_dict (schema )
652- output .write (yaml .dump (schema_dict ))
655+ output .write (yaml .dump (schema_dict , sort_keys = sort_keys ))
653656 #output.write(yaml_dumper.dumps(schema))
654657
655658
0 commit comments