File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,11 @@ def get_args(args=None):
4141 parser .add_argument (
4242 '-o' , '--output' ,
4343 action = 'store' ,
44- help = 'output file. If not defined, the GOABD is written to stdout.' ,
44+ help = (
45+ 'output file or directory. '
46+ 'If not defined, the GOABD is written to stdout.' ),
47+ type = Path ,
48+ metavar = 'PATH' ,
4549 default = None ,
4650 )
4751
@@ -562,9 +566,13 @@ def main(test_args=None):
562566 glyph_order = get_glyph_order (f , args .template )
563567 glyph_name_dict = make_glyph_name_dict (f , glyph_order )
564568 goadb = build_goadb (glyph_order , glyph_name_dict )
569+ output_path = args .output
565570
566- if args .output :
567- with open (args .output , 'w' ) as blob :
571+ if output_path and output_path .is_file ():
572+ with open (output_path , 'w' ) as blob :
573+ blob .write (goadb + '\n ' )
574+ elif output_path and output_path .is_dir ():
575+ with open (output_path / 'GlyphOrderAndAliasDB' , 'w' ) as blob :
568576 blob .write (goadb + '\n ' )
569577 else :
570578 print (goadb )
You can’t perform that action at this time.
0 commit comments