error if no -o option provided when reading input from stdin

since we can't make up an output filename in that case
This commit is contained in:
Cosimo Lupo 2023-03-03 16:51:33 +00:00
parent 1d6326ea61
commit 6c6373a0a4
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8

View File

@ -5,8 +5,9 @@ TTX -- From OpenType To XML And Back
If an input file is a TrueType or OpenType font file, it will be If an input file is a TrueType or OpenType font file, it will be
decompiled to a TTX file (an XML-based text format). decompiled to a TTX file (an XML-based text format).
If an input file is a TTX file, it will be compiled to whatever If an input file is a TTX file, it will be compiled to whatever
format the data is in, a TrueType or OpenType/CFF font file. format the data is in, a TrueType or OpenType/CFF font file.
A special input value of - means read from the standard input.
Output files are created so they are unique: an existing file is Output files are created so they are unique: an existing file is
never overwritten. never overwritten.
@ -418,6 +419,8 @@ def parseOptions(args):
if options.outputFile: if options.outputFile:
output = options.outputFile output = options.outputFile
else: else:
if input == "-":
raise getopt.GetoptError("Must provide -o when reading from stdin")
output = makeOutputFileName( output = makeOutputFileName(
input, options.outputDir, extension, options.overWrite input, options.outputDir, extension, options.overWrite
) )