summaryrefslogtreecommitdiff
path: root/cmd2/ansi.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-27 11:03:09 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-06-27 11:03:09 -0400
commit447479ecd6ef2cf01434485c4c93537c8be1a566 (patch)
tree8d823db306a78b6aa4ae61987b0a870c32cc4d9d /cmd2/ansi.py
parent5b7a45edf20d70a19c6b8d3706d8e542e1bcf30d (diff)
downloadcmd2-git-447479ecd6ef2cf01434485c4c93537c8be1a566.tar.gz
Made allow_ansi an application-wide setting and moved it to ansi.py
Diffstat (limited to 'cmd2/ansi.py')
-rw-r--r--cmd2/ansi.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd2/ansi.py b/cmd2/ansi.py
index 7ae9016e..3e5fdbc2 100644
--- a/cmd2/ansi.py
+++ b/cmd2/ansi.py
@@ -8,6 +8,14 @@ import colorama
from colorama import Fore, Back, Style
from wcwidth import wcswidth
+# Values for allow_ansi setting
+ANSI_NEVER = 'Never'
+ANSI_TERMINAL = 'Terminal'
+ANSI_ALWAYS = 'Always'
+
+# Controls when ANSI escape sequences are allowed in output
+allow_ansi = ANSI_TERMINAL
+
# Regular expression to match ANSI escape sequences
ANSI_ESCAPE_RE = re.compile(r'\x1b[^m]*m')