diff options
| author | Marc Deslauriers <marc.deslauriers@canonical.com> | 2020-08-17 10:38:59 -0400 |
|---|---|---|
| committer | Marc Deslauriers <marc.deslauriers@canonical.com> | 2020-08-17 10:38:59 -0400 |
| commit | 97e2fe7d181e8711e0f5253d3b8db40426c17f1e (patch) | |
| tree | 65dc3e7e919d46fdf3b6db062f856ec8cef7e999 /add-apt-repository | |
| parent | 05f34434ebc938c317284ec8843089c3dd89acd8 (diff) | |
add-apt-repository: strip ANSI sequences from the description.0.99.3ubuntu/groovy
Diffstat (limited to 'add-apt-repository')
| -rwxr-xr-x | add-apt-repository | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/add-apt-repository b/add-apt-repository index ba33aa5..cf0e3c9 100755 --- a/add-apt-repository +++ b/add-apt-repository @@ -4,6 +4,7 @@ from __future__ import print_function import io import os +import re import sys import gettext import locale @@ -129,8 +130,11 @@ class AddAptRepository(object): '''Display more information about the shortcut / ppa info''' print(_("Repository: '%s'") % shortcut.SourceEntry().line) if shortcut.description: + # strip ANSI escape sequences + description = re.sub(r"(\x9B|\x1B\[)[0-?]*[ -/]*[@-~]", + "", shortcut.description) print(_("Description:")) - print(shortcut.description) + print(description) if shortcut.web_link: print(_("More info: %s") % shortcut.web_link) if self.options.remove: |
