migration_status: Update ANSI code clean up regex.

in `get_migrations_status`, we clean up the printed output of any ANSI
codes used to format the output. Currently the regex only cleans up bold
ANSI escape code (\x1b[1m) and style reset code (\x1b[0m). So it won't
be able to clean up basic ANSI escape codes such as "\x1b\31;1m" which
is used to format `showmigrations` output for apps with no migrations.
   e.g, "\x1b\31;1m (no migrations)"

This commit updates the regex to catch a wider range of basic ANSI
codes.
This commit is contained in:
PieterCK
2025-01-14 13:34:26 +07:00
committed by Tim Abbott
parent 5f2286353f
commit 7a2b91ae97

View File

@@ -37,4 +37,4 @@ def get_migration_status(**options: Any) -> str:
)
out.seek(0)
output = out.read()
return re.sub(r"\x1b\[(1|0)m", "", output)
return re.sub(r"\x1b\[[0-9;]*m", "", output)