From 365b0bfce17d0eae765a6f432928c5a075871027 Mon Sep 17 00:00:00 2001 From: Roozbeh Pournader Date: Fri, 27 Jun 2014 11:20:59 -0700 Subject: [PATCH] Add support for dumping XMLs to the standard output. --- Lib/fontTools/misc/xmlWriter.py | 2 ++ Lib/fontTools/ttx.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/misc/xmlWriter.py b/Lib/fontTools/misc/xmlWriter.py index b067c2de2..cf6aa06f7 100644 --- a/Lib/fontTools/misc/xmlWriter.py +++ b/Lib/fontTools/misc/xmlWriter.py @@ -11,6 +11,8 @@ INDENT = " " class XMLWriter(object): def __init__(self, fileOrPath, indentwhite=INDENT, idlefunc=None): + if fileOrPath == '-': + fileOrPath = sys.stdout if not hasattr(fileOrPath, "write"): try: # Python3 has encoding support. diff --git a/Lib/fontTools/ttx.py b/Lib/fontTools/ttx.py index e0b5eddc8..211575be8 100644 --- a/Lib/fontTools/ttx.py +++ b/Lib/fontTools/ttx.py @@ -15,7 +15,8 @@ usage: ttx [options] inputfile1 [... inputfileN] -h Help: print this message -d Specify a directory where the output files are to be created. - -o Specify a file to write the output to. + -o Specify a file to write the output to. A special + value of of - would use the standard output. -v Verbose: more messages will be written to stdout about what is being done. -q Quiet: No messages will be written to stdout about what