Skip to content

Commit

Permalink
Add stripcolor() just in case we need it later
Browse files Browse the repository at this point in the history
  • Loading branch information
scottchiefbaker committed Sep 10, 2019
1 parent a2912e3 commit 6b89f2d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dool
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,13 @@ def perform(update):
if not op.update:
sys.stdout.write('\n')

# Borrowed from: https://stackoverflow.com/questions/14693701/how-can-i-remove-the-ansi-escape-sequences-from-a-string-in-python
def stripcolor(self, mystr):
ansi_escape = re.compile(r'\x1B[@-_][0-?]*[ -/]*[@-~]')
ret = ansi_escape.sub('', mystr)

return ret

### Main entrance
if __name__ == '__main__':
try:
Expand Down

0 comments on commit 6b89f2d

Please sign in to comment.