add 'output.skip' option

This commit is contained in:
Mike Fährmann
2021-05-04 18:07:08 +02:00
parent c5ca7905ce
commit e300da1424
3 changed files with 19 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2020 Mike Fährmann
# Copyright 2015-2021 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -232,15 +232,19 @@ def select():
}
omode = config.get(("output",), "mode", "auto").lower()
if omode in pdict:
return pdict[omode]()
output = pdict[omode]()
elif omode == "auto":
if hasattr(sys.stdout, "isatty") and sys.stdout.isatty():
return ColorOutput() if ANSI else TerminalOutput()
output = ColorOutput() if ANSI else TerminalOutput()
else:
return PipeOutput()
output = PipeOutput()
else:
raise Exception("invalid output mode: " + omode)
if not config.get(("output",), "skip", True):
output.skip = util.identity
return output
class NullOutput():