Added ansi.strip_ansi as a convenience shortcut to remove ansi markup from a string.

This commit is contained in:
Griatch 2015-07-08 14:29:34 +02:00
parent 8d37627dfe
commit 8c5dddd062

View file

@ -354,6 +354,13 @@ def parse_ansi(string, strip_ansi=False, parser=ANSI_PARSER, xterm256=False, mxp
return parser.parse_ansi(string, strip_ansi=strip_ansi, xterm256=xterm256, mxp=mxp)
def strip_ansi(string, parser=ANSI_PARSER):
"""
Strip all ansi from the string.
"""
return parser.parse_ansi(string, strip_ansi=True)
def strip_raw_ansi(string, parser=ANSI_PARSER):
"""
Remove raw ansi codes from string