diff options
author | Jan Pokorný <jpokorny@redhat.com> | 2014-03-07 21:40:55 +0100 |
---|---|---|
committer | Jan Pokorný <jpokorny@redhat.com> | 2014-03-07 21:40:55 +0100 |
commit | 0207eb0e0c5bbe4c132865192667d9de7b89f84e (patch) | |
tree | 0112451a421ea02d48eb4e46acf50910540e2f2c /format.py | |
parent | 0434412835b433a42b876c0553dfb457c329abc8 (diff) | |
download | clufter-0207eb0e0c5bbe4c132865192667d9de7b89f84e.tar.gz clufter-0207eb0e0c5bbe4c132865192667d9de7b89f84e.tar.xz clufter-0207eb0e0c5bbe4c132865192667d9de7b89f84e.zip |
format: '-' file specification on output means stdout as usual
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
Diffstat (limited to 'format.py')
-rw-r--r-- | format.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -12,7 +12,7 @@ import logging from copy import deepcopy from os import extsep, walk from os.path import commonprefix, splitext, basename -from sys import modules +from sys import modules, stdout from lxml import etree @@ -189,8 +189,11 @@ class SimpleFormat(Format, MetaPlugin): @Format.producing('file') def get_file(self, protocol, filename): - with file(filename, 'wb') as f: - f.write(self('bytestring')) + if filename == '-': + stdout.write(self('bytestring')) + else: + with file(filename, 'wb') as f: + f.write(self('bytestring')) return filename |