summaryrefslogtreecommitdiff
path: root/cmd2/utils.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-27 14:22:17 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-27 14:22:17 -0400
commit9019944689dbe36c00dfde7372e5075a8350bfb5 (patch)
treec7072b494d59b75a660be7114afcf3a6ac2c5d64 /cmd2/utils.py
parent0d4cf470486ca20f9c7d6580161a3ff689172523 (diff)
parent1306eebade58d7ffe5d0ab4008006b7fb3501b54 (diff)
downloadcmd2-git-9019944689dbe36c00dfde7372e5075a8350bfb5.tar.gz
Merge branch 'master' into ply
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r--cmd2/utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py
new file mode 100644
index 00000000..33215dc0
--- /dev/null
+++ b/cmd2/utils.py
@@ -0,0 +1,13 @@
+#
+# coding=utf-8
+"""Shared utility functions"""
+
+from . import constants
+
+def strip_ansi(text: str) -> str:
+ """Strip ANSI escape codes from a string.
+
+ :param text: string which may contain ANSI escape codes
+ :return: the same string with any ANSI escape codes removed
+ """
+ return constants.ANSI_ESCAPE_RE.sub('', text)